[gradsusr] Writing GrADS netCDF files with IDL

Lynnes, Christopher S. (GSFC-6102) christopher.s.lynnes at nasa.gov
Fri Sep 16 09:49:16 EDT 2011


On Sep 15, 2011, at 1:07 PM, Bantges, Richard J wrote:

> Hi - thanks to everyone that took the time to reply to my query, apologies that I didn't respond to each of you individually.
> 
> I've managed to write a GrADS compatible netCDF file (using IDL) that can be opened using sdfopen in GrADS. 
> 
> However, I'm now trying to figure out if it's possible to do the following with the realms of sdfopen (i.e. I don't want to write a control file if  it can be avoided):
> 1. Define what the missing values in my data array are. I know how this could be done using a control file, but is it possible to include this within the netCDF?
> 2. I have a 2D data array, that ideally I'd like to make 3D (x,y,z)   (where x longitude, y latitude, and z would be levels). Again I know how to do this using a control file, but would like to know if it's possible to do this within the netCDF file, such that sdfopen in GrADS will read it.
> 
> If I have to write a control file, then so be it, but I don't use GrADS at all (I'm learning) but I need to supply some data in this format.
> 
> Many thanks,
> Rich 

Normally I wouldn't suggest an alternative tool on the GrADS mail list, but since your focus is on creating data that are GrADS-friendly...
You may want to add nco (netCDF Operator) to your toolchest:  it has some handy tools for munging netCDF files, like ncatted, for adding a _FillValue attribute to a variable in the netCDF file, and ncap2, which has some capabilities for reshaping arrays.  See http://nco.sourceforge.net/.

> 
> 
> On 9/13/2011 9:49 AM, Bantges, Richard J wrote:
>> Hi there,
>> 
>> I'm trying to write a GrADS compatible netCDF file using ITT's IDL 
>> software, that can then be read in using GrADS's sdfopen command.
>> Does anyone have an example IDL procedure that does this please?
>> 
>> I've managed to write out data in a gridded binary data file that is 
>> described here http://grads.iges.org/grads/gadoc/aboutgriddeddata.html 
>> but ideally I'd like to write these in netCDF format. The main problem 
>> is writing the netCDF so that the associated control file accurately 
>> describes the netCDF file content.
>> 
>> So, if anyone has a very simple IDL procedure that writes out a netCDF 
>> file that can be directly read by GrADS using the sdfopen command that 
>> would be fantastic.
> 
> 
> 
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr

--
Dr. Christopher Lynnes     NASA/GSFC, Code 610.2    phone: 301-614-5185






More information about the gradsusr mailing list