[gradsusr] opening a SOI or SAM netcdf file using grads

Malcolm Tang malct32 at gmail.com
Wed Jul 22 22:33:13 EDT 2015


Hi Andrew,

I have actually solved the problem.
GrADS expects every NetCDF file to have latitudes and longitudes, even if
your file contains only timeseries. Grads also requires the contents of the
file to be CF-conforming.

This latter requirement mandates that the time coordinate variable is of
the units "months since ...."  (or years or days since).

The solution is to add lat and lon scalar arrays to the NetCDF file and
save as a new NetCDF, then produce a descriptor file to open the new NetCDF.

You need to first convert the problem.nc to text(cdl) file using the ncdump
feature eg.

> ncdump -c problem.nc
> ncdump -b c problem.nc>solution.cdl

open the solution.cdl and add in the lon and lat. You can copy the lon and
lat from other nc files that work.

Then, you need to convert the solution.cdl to solution.nc by using ncgen eg.

> ncgen solution.cdl
> ncgen -o solution.nc solution.cdl

Then create a descriptor file to open the solution.nc
It works for me.

Regards,
Malcolm

On Tue, Jul 21, 2015 at 5:50 PM, Andrew Friedman <andfried at gmail.com> wrote:

> I was wondering if anyone has found a solution for this question on time
> series netcdf files.
>
> I've tried witing a control file with the x line
>
> XDEF 1 linear 0 1
>
> but it returns the following:
>
> gadxdf error: Missing or invalid dimension size.
>   --> The invalid description file record is:
>   --> xdef 1 linear 0 1
>
> Thanks,
> Andrew
>
>
>
> On Tue, Jul 14, 2015 at 8:06 AM, Malcolm Tang <malct32 at gmail.com> wrote:
>
>> Hi,
>>
>> I have downloaded a Southern oscillation index(SOI) netcdf file, and it
>> has only 1 dimension (time).
>>
>> When I tried open it using "open" command, it says there is "unknown
>> keyword in description file", when I tried open it using "sdfopen" command
>> it says there is no discernable X coordinate.
>> And since it doesn't have x or y coordinate, how should I write a
>> descriptor file so I could try open it using "xdfopen" command?
>>
>> Can anyone please advise?
>>
>> Regards,
>> Malcolm
>>
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr
>>
>>
>
> _______________________________________________
> 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/20150723/ae25a87c/attachment.html 


More information about the gradsusr mailing list