[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #UMG-544863]: netcdf error

Hi Luis,

> Hi fellows am having some issues with two different kinds of netcdf one
> came from grads sdfwrite command which I have been using it since I need
> to write my MM5OUTPUT into netcdf. It was working good but when I try to
> load it into IDV and do some aggregation I get and error because the
> netcdf does not have the time dimension so I when to grads script and
> add the parameter -4d to add 2 more dimensions and it works now I have
> time and level dimensions now.
> The thing is here we are trying to generate a product which need to be
> in netcdf but we are using ArcGIS to generate it when we try to export
> the shape or the raster file into a netcdf file we don't get the file
> with the time dimension and level dimension and I have try to add them
> using the netcdf java tool but without success. I am trying to do that
> because I want to use both in IDV but when I make a try the IDV send me
> an error saying type mismatch.
> Attach are 2 of those files. Someone can help me

We don't have ArcGIS here, so can't help with generating the time or
level dimensions that way, but you may be able to use the ncdump and
ncgen utility programs that come with netCDF to do what you want.

For test_Sh.nc, for example, just run 

  ncdump test_Sh.nc > test_Sh.cdl

to get the netCDF file in CDL form.  Then run an editor on that CDL
file, editing the declaration of a time and level dimension, as well
as use of the time dimension by the hum_aoi0 variable, something like:

        lon = 377 ;
        lat = 298 ;
        lev = 4;  // or how ever many levels you have
        time = 100; // or how many times you have
        double lon(lon) ;
                lon:long_name = "longitude coordinate" ;
                lon:standard_name = "longitude" ;
                lon:units = "degrees_east" ;
        double lat(lat) ;
                lat:long_name = "latitude coordinate" ;
                lat:standard_name = "latitude" ;
                lat:units = "degrees_north" ;
        double lev(lev) ; // example, if using pressure for level
                lev:long_name = "pressure level" ;
                lev:positive = "down" ;
                lev:units = "hPa" ;  // hecto Pascals, same as millibars
        double time(time) ;
                time:long_name = "time" ;
                time:units = "days since 1970-01-01 00:00:00" ;

        byte hum_aoi0(time, lev, lat, lon) ;
     lev = 1000, 850, 500, 100;  // or whatever ...
     time = ... // whatever

Then, use ncgen to get the edited CDL converted back to a netCDF file, 
for example 

   ncgen -o test_Sh_with_lev_time.nc test_Sh.cdl

will read your edited CDL file and convert it to a new netCDF file
named test_Sh_with_lev_time.nc.

The ncdump and ncgen programs are part of the standard netCDF software


Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu

Ticket Details
Ticket ID: UMG-544863
Department: Support netCDF
Priority: High
Status: Closed

NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.