[netcdfgroup] changing dimensions of an existing variable [SEC=UNCLASSIFIED]

Hello, I have a question about altering the variable structure of an existing 
netcdf file.

Due to a change in specs, our file structure needs to remove one of the 
dimensions of a variable.  Currently, the variable 'lon' is 3d, and we now need 
to remove the 'time' dimension.

we need to change lon(time,nj,ni) to lon(nj,ni), where 'time' was/is always = 
1, while the other 2 dimensions vary from file to file.

I hoped that it was possible write a c program to just read in 'lon', delete it 
from the file, and then declare 'lon' with the new dimensions and write it out. 
 I have been informed that this is not possible, and that my only option is to 
read all the data from all variables and globals, and reconstruct the entire 
file.

Can someone confirm if this is indeed necessary??

Thankyou for your help.

George


A portion of the current file structure is shown here --

netcdf 
20090701-ABOM-L2P_GHRSST-SSTsubskin-AVHRR17_D-20090701T1104Z_Asc-v02.0-fv01.0 {
dimensions:
        ni = 2048 ;
        nj = 7457 ;
        time = 1 ;
variables:
        float lon(time, nj, ni) ;
                lon:long_name = "longitude" ;
                lon:units = "degrees_east" ;
                lon:_FillValue = -999.f ;
                lon:valid_min = -180.f ;
                lon:valid_max = 360.f ;
                lon:coordinates = "lon lat" ;
        float lat(time, nj, ni) ;
                lat:long_name = "latitude" ;
                lat:units = "degrees_north" ;
                lat:_FillValue = -999.f ;
                lat:valid_min = -90.f ;
                lat:valid_max = 90.f ;
                lat:coordinates = "lon lat" ;
        int time(time) ;
                time:long_name = "reference time of sst file" ;
                time:units = "seconds since 1981-01-01 00:00:00" ;
        short sea_surface_temperature(time, nj, ni) ;
                sea_surface_temperature:long_name = "sea surface subskin 
temperature" ;
                sea_surface_temperature:units = "kelvin" ;
                sea_surface_temperature:_FillValue = -32768s ;
                sea_surface_temperature:add_offset = 273.15 ;
                sea_surface_temperature:scale_factor = 0.01 ;
                sea_surface_temperature:valid_min = -5000s ;
                sea_surface_temperature:valid_max = 5000s ;
                sea_surface_temperature:coordinates = "lon lat" ;
                sea_surface_temperature:source = "AVHRR17_D" ;
// global attributes:
                :Conventions = "CF-1.4" ;
                :title = "AUS HRPT AVHRR SST Retrieval from NOAA-17" ;
                :DSD_entry_id = "AVHRR17_D-ABOM-L2P" ;

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