Skip to content

Recipe Read file metadata

Matthew Thompson edited this page Oct 24, 2025 · 5 revisions

Problem

We want to read metadata of downloaded file.

Solution

For the purpose of this example, we assume that we have already downloaded the file c1440_NR.inst01hr_3d_T_Cv.20060918_0900z.nc4 from the ftp server. For more information about file naming conventions, and how to download a file from the ftp server, please follow the links in the #See Also section.

The easiest way to read metadata of a G5NR data file is to use the utility ncdump that comes with the NetCDF-4 installation.

For header information only (no data), one can issue the command

> ncdump -h c1440_NR.inst01hr_3d_T_Cv.20060918_0900z.nc4

resulting in

`netcdf c1440_NR.inst01hr_3d_T_Cv.20060918_0900z {` `dimensions:` `    lon = 720 ;` `    lat = 361 ;` `    lev = 72 ;` `    time = UNLIMITED ; // (1 currently)` `variables:` `    double lon(lon) ;` `        lon:long_name = "longitude" ;` `        lon:units = "degrees_east" ;` `    double lat(lat) ;` `        lat:long_name = "latitude" ;` `        lat:units = "degrees_north" ;` `    double lev(lev) ;` `        lev:long_name = "vertical level" ;` `        lev:units = "layer" ;` `        lev:positive = "down" ;` `        lev:coordinate = "eta" ;` `        lev:standard_name = "model_layers" ;` `    int time(time) ;` `        time:long_name = "time" ;` `        time:units = "minutes since 2006-09-18 09:00:00" ;` `        time:time_increment = 10000 ;` `        time:begin_date = 20060918 ;` `        time:begin_time = 90000 ;` `    float T(time, lev, lat, lon) ;` `        T:long_name = "air_temperature" ;` `        T:units = "K" ;` `        T:_FillValue = 1.e+15f ;` `        T:missing_value = 1.e+15f ;` `        T:fmissing_value = 1.e+15f ;` `        T:scale_factor = 1.f ;` `        T:add_offset = 0.f ;` `        T:standard_name = "air_temperature" ;` `        T:vmin = -1.e+15f ;` `        T:vmax = 1.e+15f ;` `        T:valid_range = -1.e+15f, 1.e+15f ;`
// global attributes:
        :History = "File written by MAPL_CFIO" ;
        :Source = "wmp-Ganymed-4_0_BETA8" ;
        :Title = "3d,1-Hourly,Instantaneous,Model-Level,Coarsened to 1/2 degree,Air Temperature" ;
        :Contact = "http://gmao.gsfc.nasa.gov" ;
        :Conventions = "COARDS" ;
        :Institution = "NASA Global Modeling and Assimilation Office" ;
        :References = "http://gmao.gsfc.nasa.gov" ;
        :Comment = "7-km_Non-Hydrostatic_Nature_Run" ;
}

Discussions

See Also

  1. Recipe: File naming conventions
  2. Recipe: Retrieve (global) data from FTP server

No Warranty

Copyright

Clone this wiki locally