[gradsusr] Writing a netcdf in fortran that's readable by grads
James T. Potemra
jimp at hawaii.edu
Thu Jan 15 18:04:17 EST 2015
Might be the same deal, i.e., need dimensions on time. Try something
like "days since 1999-1-1 00:00:00" or whatever is appropriate.
Jim
On 1/15/15 12:12 PM, Thomas Robinson wrote:
> Thank you for the reply.
> I added:
> istatus = nf90_def_var(ncid,"lat", nf90_float, ila, ilat )
> write (6,*) trim(nf90_strerror(istatus))
> i*status = nf90_put_att(ncid, ilat, 'units', 'degrees_north')*
> istatus = nf90_def_var(ncid,"lon", nf90_float, ilo, ilon )
> write (6,*) trim(nf90_strerror(istatus))
> *istatus = nf90_put_att(ncid, ilon, 'units', 'degrees_east')*
>
> To give units to the latitude and longitude. Now I have a new error:
>
> ga-> sdfopen foo.nc <http://foo.nc>
> Scanning self-describing file: foo.nc <http://foo.nc>
> SDF file has no discernable time coordinate -- using default values.
> gadsdf: SDF file does not have any non-coordinate variables.
>
> What does that mean?
>
> On Thu, Jan 15, 2015 at 11:53 AM, James T. Potemra <jimp at hawaii.edu
> <mailto:jimp at hawaii.edu>> wrote:
>
> Hi Tom,
>
> I think you'll need to add attributes to your variables,
> specifically the units. For lat and lon these
> should be "degrees_north" and "degrees_east".
>
> Jim
>
>
> On 1/15/15 11:38 AM, Thomas Robinson wrote:
>> Aloha Grads Users,
>>
>> I am bringing in some data and running calculations using fortran
>> 90. I want to output the data as a netCDF file, and I would like
>> it to be readable by grads. I have no problem creating a file
>> called foo.nc <http://foo.nc> and putting my lat, lon, and ref
>> variables in the file. The problem is if I go to grads and type
>> 'sdfopen foo.nc <http://foo.nc>', it says
>> ga-> sdfopen foo.nc <http://foo.nc>
>> Scanning self-describing file: foo.nc <http://foo.nc>
>> gadsdf: SDF file has no discernable X coordinate.
>> To open this file with GrADS, use a descriptor file with an
>> XDEF entry.
>> Documentation is at
>> http://iges.org/grads/gadoc/SDFdescriptorfile.html
>> What do I need to add to make the file self describing?
>> I'm not sure what I need to add to get this to work. Here is
>> what I have so far:
>>
>> istatus = nf90_create(path = "foo.nc <http://foo.nc>", cmode =
>> nf90_noclobber, ncid = ncid)
>> write (6,*) trim(nf90_strerror(istatus))
>>
>> istatus =nf90_def_dim(ncid,'latitude',ny,ila)
>> write (6,*) trim(nf90_strerror(istatus))
>> istatus =nf90_def_dim(ncid,'longitude',nx,ilo)
>> write (6,*) trim(nf90_strerror(istatus))
>> istatus =nf90_def_dim(ncid,'time',1,itt)
>> write (6,*) trim(nf90_strerror(istatus))
>>
>> iids = (/ilo,ila,itt/)
>>
>> istatus = nf90_def_var(ncid,"ref", nf90_float, iids, iref )
>> write (6,*) trim(nf90_strerror(istatus))
>> istatus = nf90_def_var(ncid,"lat", nf90_float, ila, ilat )
>> write (6,*) trim(nf90_strerror(istatus))
>> istatus = nf90_def_var(ncid,"lon", nf90_float, ilo, ilon )
>> write (6,*) trim(nf90_strerror(istatus))
>> istatus = nf90_enddef(ncid)
>> write (6,*) trim(nf90_strerror(istatus))
>>
>> istatus = nf90_put_var(ncid,iref,ref)
>> write (6,*) trim(nf90_strerror(istatus))
>> istatus = nf90_put_var(ncid,ilat,latrad)
>> write (6,*) trim(nf90_strerror(istatus))
>> istatus = nf90_put_var(ncid,ilon,lonref)
>> write (6,*) trim(nf90_strerror(istatus))
>>
>> istatus = nf90_close(ncid)
>> write (6,*) trim(nf90_strerror(istatus))
>>
>> --
>> Tom Robinson
>> Treasurer - Graduate Student Organization
>> Secretary - Student Athletic Fee Committee
>> Graduate Student - Department of Atmospheric Science
>>
>>
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org <mailto:gradsusr at gradsusr.org>
>> http://gradsusr.org/mailman/listinfo/gradsusr
>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org <mailto:gradsusr at gradsusr.org>
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>
>
>
> --
> Tom Robinson
> Treasurer - Graduate Student Organization
> Secretary - Student Athletic Fee Committee
> Graduate Student - Department of Atmospheric Science
>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20150115/aa453518/attachment.html
More information about the gradsusr
mailing list