Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 

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

Re: netcdf4 and ncdump



Karsten Bolding <karsten@xxxxxxxxxxxxxxxxxxxx> writes:

> Hello
>
> I'm in the process of re-writing the output routines of a ocean model
>>From NetCDF3 to NetCDF4.

Great!

A little background: ncdump and ncgen are being actively re-worked to
handle the netCDF-4 data model extensions. So if you are frustrated
with the current limited handling of groups, user-defined types, etc.,
then relief is at hand!

However, the bad news is that the ncgen/ncdump programmer, Russ Rew,
is on travel for a conference on the CF metadata conventions.

So I will answer your questions as best I can, and Russ will no doubt
correct any mistakes I make when he eventually catches up his
email. (Or perhaps even before he gets on his flight!)

>
> As part of my efforts I would like to see if I'm actually storing data
> in my .nc file. Usually I use ncdump for that purpose but with NetCDF4 I
> get:
>
> kbk@orca:~/getm-setups/v1.6.x/haidvogel$ /opt/netcdf4/bin/ncdump getm.nc
> netcdf getm {
> dimensions:
>         lon = 130 ;
>         lat = 5 ;
>         z = 21 ;
> variables:
>         float lon(lon) ;
>         float lat(lat) ;
>         float level(z) ;
>
> // global attributes:
>                 :title = "Haidvogel and Beckmann test case" ;
>                 :history = "Generated by getm, ver. 1.7.0" ;
> data:
>
>  lon = _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _,
>     _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _,
>     _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _,
>     _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _,
>     _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _,
>     _, _, _, _, _, _, _, _, _, _, _ ;
>
>  lat = _, _, _, _, _ ;
>
>  level = _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ ;
>
> group: 2d {
> dimensions:
>         time = UNLIMITED ; // (48 currently)
> variables:
>         float time(time) ;
>         float elev(time, lat, lon) ;
>         float U(time, lat, lon) ;
>         float V(time, lat, lon) ;
> data:
> }
> }
>
> Notice that it is listed that there are 48 in the unlimited dimension I
> do hwoever not see any data listed. For testing I just dump random
> numbers into elev, U and V.
>
> Is that a new feature of ncdump?

Feature or bug? Just a matter of definition, right? ;-)

This one is a bug. I see now what the problem is, and it will affect
any variable in a group where the unlimited dimension is not defined
in the same group. In this case, ncdump will treat the variable as if
it were empty. 

Whoops! My fault. Sorry.

We will get this fixed shortly, as soon as we all get back from this trip.

Meanwhile, you can use h5dump to check your data.

> Another question - I'm I right in the assumption that I can inherit
> dimensions from the root group - as shown above - does that imply I also
> inherit the root coordinate variables?

No it does not!

Coordinate variables are like any other variables. They are local to
their group, and their varid is local to their group too. You need the
varid and the ncid (which identifies both file and group) to identify
a variable.

>
> Karsten
>
>
> PS: The file in question can be downloaded here:
> ftp://bbh.homelinux.net/pub/karsten.bolding/getm.nc

Thanks, that was very helpful!

Ed
-- 
Ed Hartnett  -- ed@xxxxxxxxxxxxxxxx

===============================================================================
To unsubscribe netcdfgroup, visit:
http://www.unidata.ucar.edu/mailing-list-delete-form.html
===============================================================================


 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Office of Programs University Corporation for Atmospheric Research (UCAR)   Unidata is a member of the UCAR Office of Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690