Project

General

Profile

RE: cdo selname & sellevel are changing my dimension labels. How can I stop this?

Added by Janusz M about 9 years ago

I am using cdo to reduce the number of variables and the number of layers from a WRF run so I can input them into FLEXPART-WRF. The dimension labels are chaning and I can't use the files as a result. How can I get cdo to stick with the same label names? Is there a setting I am missing?

cdo sellevel,$levels -selname,$variables originalFile.nc newFile.nc

ncdump -h originalFile.nc
dimensions:
        Time = UNLIMITED ; // (1 currently)
        DateStrLen = 19 ;
        west_east = 507 ;
        south_north = 388 ;
        bottom_top = 40 ;
        bottom_top_stag = 41 ;
        soil_layers_stag = 6 ;
        west_east_stag = 508 ;
        south_north_stag = 389 ;

ncdump -h newFile.nc
dimensions:
        x = 40 ;
        x_2 = 508 ;
        y = 388 ;
        x_3 = 507 ;
        y_2 = 389 ;
        x_4 = 507 ;
        y_3 = 388 ;
        lev = 30 ;
        time = UNLIMITED ; // (1 currently)

All the corresponding variable coordinate labels change as well...


Replies (10)

RE: RE: cdo selname & sellevel are changing my dimension labels. How can I stop this? - Added by Ralf Mueller almost 8 years ago

Please update, this problem is already solved.

cheers
ralf

RE: RE: cdo selname & sellevel are changing my dimension labels. How can I stop this? - Added by Stefan Hagemann almost 4 years ago

The issue seems to ahve reappeared in version cdo-1.9.8-magicsxx-gcc64 (mistral), at least for cdo sellevel.

RE: RE: cdo selname & sellevel are changing my dimension labels. How can I stop this? - Added by Ralf Mueller almost 4 years ago

hi Stephan!

do you have sample input for testing?

cheers
ralf

RE: RE: cdo selname & sellevel are changing my dimension labels. How can I stop this? - Added by Stefan Hagemann almost 4 years ago

Hallo Ralf,

/mnt/lustre01/scratch/g/g260122/tmp/lev_3.nc
cdo infov lev_3.nc ergibt

-1 :       Date     Time   Level Gridsize    Miss :     Minimum        Mean     Maximum : Parameter name
1 : 2014-01-01 00:00:00 1 219600 0 : 0.0000 0.0000 0.0000 : CLC_SGS
2 : 2014-01-01 00:00:00 2 219600 0 : 0.0000 0.0000 0.0000 : CLC_SGS
3 : 2014-01-01 00:00:00 3 219600 0 : 0.0000 0.0000 0.0000 : CLC_SGS

cdo sellevel,2,3 lev_3.nc l23.nc

cdo infov l23.nc
-1 : Date Time Level Gridsize Miss : Minimum Mean Maximum : Parameter name
1 : 2014-01-01 00:00:00 1 219600 0 : 0.0000 0.0000 0.0000 : CLC_SGS
2 : 2014-01-01 00:00:00 2 219600 0 : 0.0000 0.0000 0.0000 : CLC_SGS

Tatsächlich wollte ich mir definiert aus drei einzeldateien drei Level generieren, was mir aufgrund des BUgs unmöglich ist.
Dies hier war eine fertige datei, wo zufällig alle felder null sind, aber das Problem anschaulich zunzeigen ist.
Gruß
stefan

RE: RE: cdo selname & sellevel are changing my dimension labels. How can I stop this? - Added by Ralf Mueller almost 4 years ago

hi Stephan!

I checked your input:

netcdf lev_3 {
dimensions:
    time = UNLIMITED ; // (1 currently)
    bnds = 2 ;
    rlon = 450 ;
    rlat = 488 ;
    level = 3 ;
variables:
    float time(time) ;
        time:standard_name = "time" ;
        time:long_name = "time" ;
        time:bounds = "time_bnds" ;
        time:units = "seconds since 2014-01-01T00:00:00Z" ;
        time:calendar = "proleptic_gregorian" ;
        time:axis = "T" ;
    double time_bnds(time, bnds) ;
    float lon(rlat, rlon) ;
        lon:standard_name = "longitude" ;
        lon:long_name = "longitude" ;
        lon:units = "degrees_east" ;
        lon:_CoordinateAxisType = "Lon" ;
    float lat(rlat, rlon) ;
        lat:standard_name = "latitude" ;
        lat:long_name = "latitude" ;
        lat:units = "degrees_north" ;
        lat:_CoordinateAxisType = "Lat" ;
    float rlon(rlon) ;
        rlon:standard_name = "grid_longitude" ;
        rlon:long_name = "rotated longitude" ;
        rlon:units = "degrees" ;
        rlon:axis = "X" ;
    float rlat(rlat) ;
        rlat:standard_name = "grid_latitude" ;
        rlat:long_name = "rotated latitude" ;
        rlat:units = "degrees" ;
        rlat:axis = "Y" ;
    int rotated_pole ;
        rotated_pole:long_name = "coordinates of the rotated North Pole" ;
        rotated_pole:grid_mapping_name = "rotated_latitude_longitude" ;
        rotated_pole:grid_north_pole_latitude = 39.25f ;
        rotated_pole:grid_north_pole_longitude = -162.f ;
    float CLC_SGS(time, level, rlat, rlon) ;
        CLC_SGS:standard_name = "stratiform_cloud_area_fraction_in_atmosphere_layer" ;
        CLC_SGS:long_name = "grid scale cloud area fraction" ;
        CLC_SGS:units = "1" ;
        CLC_SGS:grid_mapping = "rotated_pole" ;
        CLC_SGS:coordinates = "lat lon" ;

// global attributes:
        :CDI = "Climate Data Interface version 1.9.8 (https://mpimet.mpg.de/cdi)" ;
        :Conventions = "CF-1.4" ;
        :history = "Mon Mar 30 15:17:34 2020: cdo sellevel,37/39 -selvar,CLC_SGS lffd2014010100.nc lev_3.nc" ;
        :source = "cosmoc_standalone, int2lm_v2.05_clm1.exe," ;
        :institution = "Helmholtz-Zentrum Geesthacht Centre for Materials and Costal Research" ;
        :title = "Europe 0.11" ;
        :experiment_id = "CCLM_SGCC" ;
        :realization = 1 ;
        :conventionsURL = "http://www.cfconventions.org/" ;
        :references = "http://www.clm-community.eu/" ;
        :creation_date = "2020-03-24 15:50:50" ;
        :CDO = "Climate Data Operators version 1.9.8 (https://mpimet.mpg.de/cdo)" ;
when I do a sellevel,2 I get the same dimension names
:~$ cdo -f nc -sellevel,2 lev_3.nc lev_3LEV2.nc 
cdo    sellevel: Processed 1 variable over 1 timestep [0.04s 36MB].
$ ncdump -h lev_3LEV2.nc 
netcdf lev_3LEV2 {
dimensions:
    time = UNLIMITED ; // (1 currently)
    bnds = 2 ;
    rlon = 450 ;
    rlat = 488 ;
    level = 1 ;
variables:
    float time(time) ;
        time:standard_name = "time" ;
        time:long_name = "time" ;
        time:bounds = "time_bnds" ;
        time:units = "seconds since 2014-01-01T00:00:00Z" ;
        time:calendar = "proleptic_gregorian" ;
        time:axis = "T" ;
    double time_bnds(time, bnds) ;
    float lon(rlat, rlon) ;
        lon:standard_name = "longitude" ;
        lon:long_name = "longitude" ;
        lon:units = "degrees_east" ;
        lon:_CoordinateAxisType = "Lon" ;
    float lat(rlat, rlon) ;
        lat:standard_name = "latitude" ;
        lat:long_name = "latitude" ;
        lat:units = "degrees_north" ;
        lat:_CoordinateAxisType = "Lat" ;
    float rlon(rlon) ;
        rlon:standard_name = "grid_longitude" ;
        rlon:long_name = "rotated longitude" ;
        rlon:units = "degrees" ;
        rlon:axis = "X" ;
    float rlat(rlat) ;
        rlat:standard_name = "grid_latitude" ;
        rlat:long_name = "rotated latitude" ;
        rlat:units = "degrees" ;
        rlat:axis = "Y" ;
    int rotated_pole ;
        rotated_pole:long_name = "coordinates of the rotated North Pole" ;
        rotated_pole:grid_mapping_name = "rotated_latitude_longitude" ;
        rotated_pole:grid_north_pole_latitude = 39.25f ;
        rotated_pole:grid_north_pole_longitude = -162.f ;
    float CLC_SGS(time, level, rlat, rlon) ;
        CLC_SGS:standard_name = "stratiform_cloud_area_fraction_in_atmosphere_layer" ;
        CLC_SGS:long_name = "grid scale cloud area fraction" ;
        CLC_SGS:units = "1" ;
        CLC_SGS:grid_mapping = "rotated_pole" ;
        CLC_SGS:coordinates = "lat lon" ;

// global attributes:
        :CDI = "Climate Data Interface version 1.9.8 (https://mpimet.mpg.de/cdi)" ;
        :Conventions = "CF-1.4" ;
        :history = "Tue Mar 31 16:35:57 2020: cdo -f nc -sellevel,2 lev_3.nc lev_3LEV2.nc\n",
            "Mon Mar 30 15:17:34 2020: cdo sellevel,37/39 -selvar,CLC_SGS lffd2014010100.nc lev_3.nc" ;
        :source = "cosmoc_standalone, int2lm_v2.05_clm1.exe," ;
        :institution = "Helmholtz-Zentrum Geesthacht Centre for Materials and Costal Research" ;
        :title = "Europe 0.11" ;
        :experiment_id = "CCLM_SGCC" ;
        :realization = 1 ;
        :conventionsURL = "http://www.cfconventions.org/" ;
        :references = "http://www.clm-community.eu/" ;
        :creation_date = "2020-03-24 15:50:50" ;
        :CDO = "Climate Data Operators version 1.9.8 (https://mpimet.mpg.de/cdo)" ;

Did I miss anything?

RE: RE: cdo selname & sellevel are changing my dimension labels. How can I stop this? - Added by Stefan Hagemann almost 4 years ago

Hallo Ralf

sorry, I was not precise enough. I did not mean the level name, but the actual level value (which I confused with label mentioned in the original thread). When I select levels 2 and 3, they get values 1 and 2 in the output file (cf. cdo infov information I provided.

Consequently, when I conduct your operation on selelve,2, it yields
-1 : Date Time Level Gridsize Miss : Minimum Mean Maximum : Parameter name
1 : 2014-01-01 00:00:00 1 219600 0 : 0.0000 0.075494 1.0000 : CLC_SGS

Here, the level 2 changed to level 1 in the output file. But with this unwanted value change of the level it is impossible to merge different levels from different files into one file.

Best regards
Stefan

RE: RE: cdo selname & sellevel are changing my dimension labels. How can I stop this? - Added by Ralf Mueller almost 4 years ago

in your original file there is no data variable level that could hold any values - just the dimension level. Hence CDO can only select some indices and since it does not create a data variable for you in the output, these index values (2,3,...) get lost. I thing with a proper data variable, this will not happen.

cheers
ralf

    (1-10/10)