Re: [python-users] siphon help

(bringing back to list)

Adam,

For accessing level 2, you would actually remove the `.variables('N0Q')`
since all of the variables are contained within a single Level 2 file.
Using OPeNDAP, though, you're still only downloading data for the
parameters you access, through code like `ref =
data.variables['BaseReflectivityDR'][:]`

Ryan

On Thu, Feb 23, 2017 at 11:31 AM, Lampl, Adam <alampl@xxxxxxxxxx> wrote:

> Thanks Ryan that helps a lot. If i want to access level 2 radar data would
> i just change line 8 to url = ds['NEXRAD Level II Radar from
> IDD'].follow().catalog_url ? or would i also have to add code for the
> different types of variables associate with level 2 data.
>
> Cheers,
> Adam
>
> On Feb 23, 2017, at 1:25 PM, Ryan May <rmay@xxxxxxxx> wrote:
>
> Adam,
>
> OPeNDAP is a tool for remote data access that allows you to access
> portions of a dataset/file without the need to download the entire thing.
> Given that, I'm not sure there's any need for you to install Tomcat and run
> your own THREDDS server. For accessing the data from THREDDS using OPeNDAP,
> all you need are:
> - siphon
> - netcdf4-python
>
> The siphon examples you mentioned use CDMRemote (cdmr) access only because
> that's built into siphon itself. To access the Level 3 NEXRAD products
> using OPeNDAP, this should suffice, where we're replacing the `Dataset`
> class pulled from `siphon.cdmr` with one pulled from `netCDF4`. Here's a
> complete example:
>
>
> from datetime import datetime
> import matplotlib.pyplot as plt
> import numpy as np
> from netCDF4 import Dataset
> from siphon.radarserver import RadarServer, get_radarserver_datasets
>
> ds = get_radarserver_datasets('http://thredds.ucar.edu/thredds/')
> url = ds['NEXRAD Level III Radar from IDD'].follow().catalog_url
> rs = RadarServer(url)
>
> query = rs.query()
> query.stations('FTG').time(datetime.utcnow()).variables('N0Q')
>
> catalog = rs.get_catalog(query)
> ds = list(catalog.datasets.values())[0]
> data = Dataset(ds.access_urls['OPENDAP'])
>
> rng = data.variables['gate'][:] / 1000.
> az = data.variables['azimuth'][:]
> ref = data.variables['BaseReflectivityDR'][:]
>
> x = rng * np.sin(np.deg2rad(az))[:, None]
> y = rng * np.cos(np.deg2rad(az))[:, None]
> ref = np.ma.array(ref, mask=np.isnan(ref))
>
> fig, ax = plt.subplots(1, 1, figsize=(9, 8))
> ax.pcolormesh(x, y, ref)
> ax.set_aspect('equal', 'datalim')
> ax.set_xlim(-460, 460)
> ax.set_ylim(-460, 460)
> plt.show()
>
>
> Ryan
>
>
> On Thu, Feb 23, 2017 at 10:24 AM, Lampl, Adam <alampl@xxxxxxxxxx> wrote:
>
>> Hello ,
>> I am looking at your siphon example to access level 3 data. For the
>> online example it uses cdmr access. I see that created is a directory of
>> scripts for cdmr. Is it possible for me to access using OPENDaP access
>> through siphon? or would i have to create a bunch of scripts to do so like
>> you do for cdmr? Also what is the advantage of downloading tomcat for what
>> I am trying to do. Having some difficulty getting it to open thredds.war
>> properly.
>> I am a student at the University at Albany interning for the Atmospheric
>> Science Research Center just trying to broaden my knowledge of data science
>> and working with a jupyter notebook. Any advice would mean a lot!
>> Thanks in advance,
>> Adam Lampl
>> _______________________________________________
>> NOTE: All exchanges posted to Unidata maintained email lists are
>> recorded in the Unidata inquiry tracking system and made publicly
>> available through the web.  Users who post to any of the lists we
>> maintain are reminded to remove any personal information that they
>> do not want to be made public.
>>
>>
>> python-users mailing list
>> python-users@xxxxxxxxxxxxxxxxxxxxxxxx
>> For list information, to unsubscribe, or change your membership options,
>> visit: http://www.unidata.ucar.edu/mailing_lists/
>>
>
>
>
> --
> Ryan May, Ph.D.
> Software Engineer
> UCAR/Unidata
> Boulder, CO
>
>
>


-- 
Ryan May, Ph.D.
Software Engineer
UCAR/Unidata
Boulder, CO
  • 2017 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the python-users archives: