NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

[netcdfgroup] Tool to extract a group from a netcdf4 file

Hi All:

Is there a convenient tool to extract the full group from a netcdf4 file and 
copy it to a new netcdf file that doesn't have groups?  To make it clearer 
below is an example header.  Say I want to create a file that only contains the 
Hindcast group?

Thanks

-Roy


netcdf \20110721T170000 {

group: Hindcast {
  dimensions:
        Time = 10725 ;
        Dist = 51 ;
        Stat = 5 ;
  variables:
        uint Time(Time) ;
                Time:Description = "Time Since 1-Apr-2011 (s)" ;
        ubyte Dist(Dist) ;
                Dist:Description = "Distance Downstream (km)" ;
        ubyte Stat(Stat) ;
                Stat:Description = "Station Number (1=KWK, 2=BSF, 3=JLF, 4=BND, 
5=RDB)" ;
        ushort GridTemp(Dist, Time) ;
                GridTemp:Description = "Gridded Temperature (deg F x 100)" ;
        ushort StatTemp(Stat, Time) ;
                StatTemp:Description = "Station Temperature (deg F x 100)" ;
  } // group Hindcast

group: Forecast {
  dimensions:
        Time = 289 ;
        Dist = 51 ;
        Stat = 5 ;
  variables:
        uint Time(Time) ;
                Time:Description = "Time Since 1-Apr-2011 (s)" ;
        ubyte Dist(Dist) ;
                Dist:Description = "Distance Downstream (km)" ;
        ubyte Stat(Stat) ;
                Stat:Description = "Station Number (1=KWK, 2=BSF, 3=JLF, 4=BND, 
5=RDB)" ;
        ushort GridTemp(Dist, Time) ;
                GridTemp:Description = "Gridded Temperature (deg F x 100)" ;
        ushort StatTemp(Stat, Time) ;
                StatTemp:Description = "Station Temperature (deg F x 100)" ;
  } // group Forecast

group: Scenario {
  dimensions:
        Time = 289 ;
        Dist = 51 ;
        Stat = 5 ;
        InitTemp = 9 ;
        InitFlow = 11 ;
  variables:
        uint Time(Time) ;
                Time:Description = "Time Since 1-Apr-2011 (s)" ;
        ubyte Dist(Dist) ;
                Dist:Description = "Distance Downstream (km)" ;
        ubyte Stat(Stat) ;
                Stat:Description = "Station Number (1=KWK, 2=BSF, 3=JLF, 4=BND, 
5=RDB)" ;
        ushort InitTemp(InitTemp) ;
                InitTemp:Description = "Initial Temperature (deg F x 100)" ;
        ushort InitFlow(InitFlow) ;
                InitFlow:Description = "Initial Flow (cfs)" ;
        ushort GridTemp(InitFlow, InitTemp, Dist, Time) ;
                GridTemp:Description = "Gridded Temperature (deg F x 100)" ;
        ushort StatTemp(InitFlow, InitTemp, Stat, Time) ;
                StatTemp:Description = "Station Temperature (deg F x 100)" ;
  } // group Scenario
}

**********************
"The contents of this message do not reflect any position of the U.S. 
Government or NOAA."
**********************
Roy Mendelssohn
Supervisory Operations Research Analyst
NOAA/NMFS
Environmental Research Division
Southwest Fisheries Science Center
1352 Lighthouse Avenue
Pacific Grove, CA 93950-2097

e-mail: Roy.Mendelssohn@xxxxxxxx (Note new e-mail address)
voice: (831)-648-9029
fax: (831)-648-8440
www: http://www.pfeg.noaa.gov/

"Old age and treachery will overcome youth and skill."
"From those who have been given much, much will be expected" 



  • 2011 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: