Project

General

Profile

latitude and longitude seen as variable instead of dimension in netCDF file.

Added by Meenakshi Sreejith over 1 year ago

Hello all,
I have a netCDF file with one variable(SST) over 12784 timesteps. It is a global 1degree data. But the latitude and longitude dimensions are shown as variables and hence the SST variable is only depending on time dimension. How can i convert lat and lon into dimensions? SHown below is the header of my netCDF file:

netcdf sst_newEc {
dimensions:
time = UNLIMITED ; // (12784 currently)
bnds = 2 ;
vertices = 4 ;
variables:
double time(time) ;
time:standard_name = "time" ;
time:long_name = "time" ;
time:bounds = "time_bnds" ;
time:units = "days since 1850-01-01 00:00:00" ;
time:calendar = "proleptic_gregorian" ;
time:axis = "T" ;
double time_bnds(time, bnds) ;
double longitude ;
longitude:standard_name = "longitude" ;
longitude:long_name = "longitude" ;
longitude:units = "degrees_east" ;
longitude:_CoordinateAxisType = "Lon" ;
longitude:bounds = "longitude_bnds" ;
longitude:cell_methods = "i: mean j: mean" ;
double longitude_bnds(vertices) ;
longitude_bnds:cell_methods = "i: mean j: mean" ;
double latitude ;
latitude:standard_name = "latitude" ;
latitude:long_name = "latitude" ;
latitude:units = "degrees_north" ;
latitude:_CoordinateAxisType = "Lat" ;
latitude:bounds = "latitude_bnds" ;
latitude:cell_methods = "i: mean j: mean" ;
double latitude_bnds(vertices) ;
latitude_bnds:cell_methods = "i: mean j: mean" ;
int i ;
i:standard_name = "projection_x_coordinate" ;
i:long_name = "cell index along first dimension" ;
i:units = "1" ;
i:axis = "X" ;
i:cell_methods = "i: mean" ;
int j ;
j:standard_name = "projection_y_coordinate" ;
j:long_name = "cell index along second dimension" ;
j:units = "1" ;
j:axis = "Y" ;
j:cell_methods = "j: mean" ;
float tos(time) ;
tos:standard_name = "sea_surface_temperature" ;
tos:long_name = "Sea Surface Temperature" ;
tos:units = "degC" ;
tos:coordinates = "latitude longitude" ;
tos:_FillValue = 1.e+20f ;
tos:missing_value = 1.e+20f ;
tos:comment = "Temperature of upper boundary of the liquid ocean, including temperatures below sea-ice and floating ice shelves." ;
tos:original_name = "tos" ;
tos:cell_methods = "area: mean where sea time: mean i: mean j: mean" ;
tos:cell_measures = "area: areacello" ;
tos:history = "2019-09-26T10:20:17Z altered by CMOR: Reordered dimensions, original order: j i time." ;


Replies (9)

RE: latitude and longitude seen as variable instead of dimension in netCDF file. - Added by Karin Meier-Fleischer over 1 year ago

Hi Meenakshi,

the variable tos depends only on time, and the latitude and longitude variables are just 1 point.

RE: latitude and longitude seen as variable instead of dimension in netCDF file. - Added by Meenakshi Sreejith over 1 year ago

How can I add latitude and longitude to it? In the metadata it was shown as a 3-D file

RE: latitude and longitude seen as variable instead of dimension in netCDF file. - Added by Meenakshi Sreejith over 1 year ago

Hello Karin
The earlier header was that of a file on which some modifications were done. The given file is the original version .

RE: latitude and longitude seen as variable instead of dimension in netCDF file. - Added by Karin Meier-Fleischer over 1 year ago

The coordinates are missing.

ncdump -h onestep.nc 
netcdf onestep {
dimensions:
    X = 1442 ;
    Y = 1050 ;
    TIME = UNLIMITED ; // (1 currently)
variables:
    double TIME(TIME) ;
        TIME:axis = "T" ;
        TIME:long_name = "Time axis" ;
        TIME:calendar = "gregorian" ;
        TIME:units = "days since 1850-01-01 00:00:00" ;
        TIME:time_origin = "1850-01-01 00:00:00" ;
        TIME:standard_name = "time" ;
    float TOS(TIME, Y, X) ;
        TOS:missing_value = 1.e+20f ;
        TOS:_FillValue = 1.e+20f ;
        TOS:long_name = "Sea Surface Temperature" ;
        TOS:units = "degC" ;
        TOS:history = "none" ;

// global attributes:
        :history = "FERRET V7.3 (optimized) 24-Nov-22" ;
        :Conventions = "CF-1.6" ;
}

RE: latitude and longitude seen as variable instead of dimension in netCDF file. - Added by Meenakshi Sreejith over 1 year ago

Hello Karin
How can I add dimensions to this tos variable? I wanted to make an index using this variable. Therefore, when I tried to give coordinates, it was not working.

RE: latitude and longitude seen as variable instead of dimension in netCDF file. - Added by Karin Meier-Fleischer over 1 year ago

You need to get the associated coordinates from where you got the data file.

RE: latitude and longitude seen as variable instead of dimension in netCDF file. - Added by Meenakshi Sreejith over 1 year ago

Hello
I downloaded the data from CMIP6 website. Is there any way i can add axis to this file?

RE: latitude and longitude seen as variable instead of dimension in netCDF file. - Added by Estanislao Gavilan over 1 year ago

Hi,

If you downloaded the data from CMIP6 website, it should have a variable for longitude and latitude. Now, if you edited the file by yourself you migh have forgotten to add the coordiantes. Take a look to the original file, and make sure that you have all the information.

Kind regards,

Estanislao

    (1-9/9)