Comments (13)
@scollis Where can I find information on the pytds module? Google finds modules which are related to MSSQL which don't seem to be correct.
I knew thredds was serving NEXRAD Level II but it was in raw msg 31 or 1 format, if they also have netCDF4 that would be great!
from pyart.
Sean Arms, Twitter @lesserwhirls
https://github.com/lesserwhirls
[email protected]
On Jul 17, 2013, at 9:11 AM, Jonathan J. Helmus [email protected] wrote:
@scollis Where can I find information on the pytds module? Google finds modules which are related to MSSQL which don't seem to be correct.
I knew thredds was serving NEXRAD Level II but it was in raw msg 31 or 1 format, if they also have netCDF4 that would be great!
—
Reply to this email directly or view it on GitHub.
from pyart.
Hello!
pytds is about one month old and is simply a place we are stuffing some tds related helper functions for our "THREDDS Data Server (TDS) - Using Python to Access Data" workshop next week here in Boulder, CO. I've been working on a TDS catalog class in python and have it to a point where I can pass it a catalog.xml URL and find all the datasets and their associated access urls under that root.
Cheers!
Sean
from pyart.
Note that you don't need the pytds module. The previous commit of that notebook does not use pytds at all:
Cheers,
Sean
from pyart.
Sean
Do you have any issue if we use some of the code from pytds or the notebook in Py-ART? We are releasing under a BSD license.
from pyart.
I don't think so. Let me check with the others working on the helper functions to see, just to make sure.
from pyart.
We are thinking of using the MIT license, as that is what netCDF-Java and netCDF-C use.
http://www.unidata.ucar.edu/blogs/developer/en/entry/new_license_for_netcdf_java
The text in the blog post is likely the same text we will use, with an updated year in the copyright at the beginning.
Sean
from pyart.
Hi All.
Jon, we chatted at scipy in Austin. Just a heads up, I think we are probably going to change the name "pytds" because it is already taken. And I am hoping to have an MIT license on the project ASAP. And after workshop (next week), we are going to work to make this module stand alone rather than associated with the notebooks. Stay tuned!
from pyart.
@scollis The files being served on the thredds OpenDAP server don't work nicely with the python-netcdf4 module because the field variables have a vector missing_value:
url = 'http://thredds.ucar.edu/thredds/dodsC/nexrad/level2/KATX/20130717/Level2_KATX_20130717_1950.ar2v'
import netCDF4
dataset = netCDF4.Dataset(url)
var = dataset.variables['Reflectivity_HI']
var[0,0,:]
>>> ...
>>> AttributeError: 'bool' object has no attribute 'any'
var.missing_value # this is were the problems come from
>>>array([1, 0], dtype=int8)
# but we can turn off the scaling and masking...
var.set_auto_maskandscale(False)
var[0,0,:]
>>> array([87, 81, 0, ..., 0, 0, 0], dtype=int8)
For anyone not interested in why this is occurring of if it is breaking a standard skip the next two paragraphs.
I'm betting this is because the server is generating the server file using the same code which runs toolUI and the NetCDF Java library (http://www.unidata.ucar.edu/software/netcdf-java/). Using toolUI to convert NCDC NEXRAD level II files results in very similar looking NetCDF files with a vector missing_value attribute.
The [1, 0] missing values are in many ways correct, in Archive Level II NEXRAD files radar moment data uses 0 to indicate a signal below threshold and 1 to indicate range folded data (footnote 21 on page 3-99 in the Interface Control Document for the RDA/RPG Open Build 13.0, 2620002M). But is this allowed in NetCDF files? The NetCDF User's guide (NUG), http://www.unidata.ucar.edu/software/netcdf/docs/netcdf.html#Attribute-Conventions, says yes. The NetCDF Climate and Forecast (CF) Metadata Conventions seems to suggest this is a no-no in the section on missing data (http://cf-pcmdi.llnl.gov/documents/cf-conventions/1.6/cf-conventions.html#missing-data) but is not clear. Now the file being served doesn't claim to follow CF conventions (dataset.Conventions is '_Coordinates') so I see no reason to call this as a non-conforming netCDF file.
Getting back to the task at hand, how can we ingest these files into Py-ART? I see four options:
1 Read these using python-netcdf4 and scale and mask the data manually after setting set_auto_maskandscale(False).
This doesn't introduce any new dependencies into Py-ART, but will only work if python-netcdf4 was compiled with OPeNDAP support (--enable-dap) which requires libcurl (which is quite common). It also mean writing a bit more code to do the masking and scaling.
2 Use Pydap (http://www.pydap.org/) to access the files, and still do the masking and scaling manually.
This introduces a number of new dependencies into Py-ART (Pydap, httplib2, Genshi, Paste, PasteDeploy, PasteScript) but they all appear(?) to be Python only modules. python-netcdf4 doesn't need to be compiled in any special way. We would still need to write the scaling and masking code as Pydap doesn't do this for us.
3 See if we can get python-netcdf4 to work with multiple variables which have missing_value.
I have know idea how hard this would be or if such a patch would be accepted by the python-netcdf4 package, but it it was supported it would make reading these files easy.
4 Get the thredds server to set only a single missing_value in the moment variables.
I'm guessing this would be a no go as the two missing values are technically correct.
Scott or anyone else have an opinion on which direction we should proceed? I'm leaning toward 1 since it is the most obtainable, but would be open to other suggestions.
Also it should be noted that I my nexrad_reader branch (https://github.com/jjhelmus/pyart/tree/nexrad_reader) should be able to read the ar2v files which can be downloaded from the thredds server using HTTP with a little more work. The message blocks just need to be decompressed during reading.
from pyart.
Ok I might have made performing the scaling, offset, and masking sound too difficult, in fact is was very easy.
The thredds_ingest branch (https://github.com/jjhelmus/pyart/tree/thredds_ingest) contains some initial code for getting a radar object from a thredds server url. Use as follows:
import pyart
from pyart.io import thredds
import matplotlib.pyplot as plt
url = 'http://thredds.ucar.edu/thredds/dodsC/nexrad/level2/KATX/20130717/Level2_KATX_20130717_1950.ar2v'
radar = thredds.read_nexrad_thredds_url(url)
display = pyart.graph.RadarDisplay(radar)
fig = plt.figure()
ax = fig.add_subplot(111)
display.plot_ppi('reflectivity', 0, ax=ax, vmin=-35, vmax=80)
fig.savefig('nexrad_ppi.png')
Result:
Looks a little too hot, I might be scaling the moments incorrectly, either that or Seattle has a good amount of rain. I'll clean up the code, make it possible to retrieve the normal resolution data, and add tests before merging into the master.
from pyart.
BTW, Sean made an NWS colormap for radar data: http://nbviewer.ipython.org/urls/raw.github.com/Unidata/tds-python-workshop/master/radar_level2.ipynb
from pyart.
A more or less complete reader for the NEXRAD Level II data served from the Thredds server is in my thredds_ingest branch, https://github.com/jjhelmus/pyart/tree/thredds_ingest. It also works with the NetCDF files creating using Unidata's NetCDF Java library (toolsUI) hence the new name CDM (common data model).
I'm merging this into my nexrad_reader branch with plans of merging that into Py-ART master once I finish the enhancements for reading NEXRAD Archive Level II files from NCDC and UCAR Thredds/Motherload are complete.
from pyart.
Pull Request #76 added support for ingest of NEXRAD Level II data from the THREDDS server as well as NCDC. I'll leave the parsing of the xml files, etc. to determine the latest radar file to grab to pytdr (or the new name) as such functionality would be outside Py-ART's scope. Closing.
from pyart.
Related Issues (20)
- plot a cross section from a grid failed HOT 3
- Sphinx Gallery Stopped Generating Hyperlinks
- DOC: Add pre-commit section to docs
- Error occured while trying to import pyart HOT 7
- BUG: Read_grid can't read output from write_grid HOT 10
- ENH: Read new variation of hdf5 file format HOT 11
- ENH: Reading WMO-FM301 (CfRadial2) files HOT 1
- ENH: Add auto-update for github actions versions HOT 3
- Incorporation of RadTraQ into Py-ART
- BUG: Build of CI wheels is currently failing - requiring multiple retries
- Incorrect base_time for ARM radars in columnsect.get_field_location HOT 1
- Get the beam width using the aux_io.read_sinarame_h5 function HOT 2
- Resolving Scan Type Discrepancies in CfRadial RHI Data Visualization HOT 2
- Ensure Xradar Data Model is Consistent in Py-ART HOT 1
- Freezing level masking in LP phase code makes invalid assumptions about scans for RHIs
- Incorrect sweep partitioning for RHIs at azimuth 0. when using the `determine_sweeps` method
- BUG: As of latest version of scipy, gaussian not imported at signal level
- Not be8ing able to write_grid_mdv properly HOT 11
- RoI calculation (in gridding routine) smear data too strongly, especially vs. z than vs. x and y (physically inconsistent) HOT 2
- Numpy 2 compatibility HOT 14
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyart.