This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
> Hi > > I am programming to read NAM-CONUS-12km data from NetCDF file. For the "time" > dimension, the name is "time1" for some variables and "time" for some other > variables. So, I cannot inquire variable id by giving a fixed name. For > example, I cannot call such as > > NetCDF.nc_inq_varid(ncid, "time1", varid_time1) > > as the name might be "time" instead of "time1". > > I wonder what '1' means in "time1" and how you would suggest to program to get > the variable id of the time dimension. The attached are two examples of the > meta data with different dimension names for the time. > > Thanks, > Thiha Min. > > > Center for Research in Water Resources > University of Texas at Austin > > ---------example1 of NetCDF meta data for Total_precipitation variable;----- > ---------it uses the name time1------------------------------------- > > netcdf NAM_CONUS_12km_20070302_1800.grib2 { > dimensions: > time1 = 12 ; > y = 11 ; > x = 2 ; > variables: > float Total_precipitation(time1, y, x) ; > Total_precipitation:units = "kg m-2" ; > Total_precipitation:long_name = "Total precipitation @ surface" ; > Total_precipitation:missing_value = -9999.f ; > Total_precipitation:grid_mapping = "Lambert_Conformal" ; > Total_precipitation:GRIB_param_discipline = "Meteorological_products" ; > Total_precipitation:GRIB_param_category = "Moisture" ; > Total_precipitation:GRIB_param_name = "Total_precipitation" ; > Total_precipitation:GRIB_param_id = 2, 0, 1, 8 ; > Total_precipitation:GRIB_product_definition_type = "Average, accumulation, > extreme values or other statistically processed value at a horizontal level" ; > Total_precipitation:GRIB_level_type = 1 ; > int time1(time1) ; > time1:long_name = "forecast time" ; > time1:units = "hours since 2007-03-02T18:00:00Z" ; > time1:GRIB_orgReferenceTime = "2007-03-02T18:00:00Z" ; > time1:GRIB2_significanceOfRTName = "Start of forecast" ; > time1:_CoordinateAxisType = "Time" ; > > ---------------------------------------------------------------------------- > --------------example2 of NetCDF metadata for Precipitable_water;------- > ------------- it uses the name "time"--------------------------- > > netcdf NAM_CONUS_12km_20070329_1200.grib2 { > dimensions: > time = 26 ; > y = 1 ; > x = 1 ; > variables: > float Precipitable_water(time, y, x) ; > Precipitable_water:units = "kg m-2" ; > Precipitable_water:long_name = "Precipitable water @ entire_atmosphere" ; > Precipitable_water:missing_value = -9999.f ; > Precipitable_water:grid_mapping = "Lambert_Conformal" ; > Precipitable_water:GRIB_param_discipline = "Meteorological_products" ; > Precipitable_water:GRIB_param_category = "Moisture" ; > Precipitable_water:GRIB_param_name = "Precipitable_water" ; > Precipitable_water:GRIB_param_id = 2, 0, 1, 3 ; > Precipitable_water:GRIB_product_definition_type = "Analysis/forecast at > horizontal level/layer" ; > Precipitable_water:GRIB_level_type = 200 ; > int time(time) ; > time:long_name = "forecast time" ; > time:units = "hours since 2007-03-29T12:00:00Z" ; > time:GRIB_orgReferenceTime = "2007-03-29T12:00:00Z" ; > time:GRIB2_significanceOfRTName = "Start of forecast" ; > time:_CoordinateAxisType = "Time" ; > ---------------------------------------------------------- > > Howdy Thiha! I'm sorry, but you will have to ask the producer of the data files why they sometimes use "time" and sometimes "time1." As far as netCDF is concerned, a time dimension may have any name at all. NetCDF doesn't use the names of dimensions in any way, it just stores them for user convenience. Thanks, Ed Ticket Details =================== Ticket ID: LXJ-482685 Department: Support netCDF Priority: Normal Status: Closed