Project

General

Profile

regriding

Added by kunal bali over 6 years ago

Dear Users,

I have data file with gridtype = generic

#
  1. gridID 0 #
    gridtype = generic
    gridsize = 1440000
    xname = x
    xunits = degrees
    yname = y
    yunits = degrees
    xsize = 1200
    ysize = 1200

The data is curvilinear grid structure. cdo is reading the file, but not able to extracting the data. So I changed the gridtype = generic to gridtype= lonlat via

cdo remapbil maiactaotE.h00v02.20010040635-20011550640.nc regrid.nc

#
  1. gridID 0 #
    gridtype = lonlat
    gridsize = 1440000
    xname = longitude
    xlongname = longitude
    xunits = degrees
    yname = latitude
    ylongname = latitude
    yunits = degrees
    xsize = 1200
    ysize = 1200
    xfirst = 64.23634233372,76.8178669755364,79.4747290253718,68.0771493550491
    xinc = 0.01
    yfirst = 32.0383879015429,34.9985549202943,24.5580030404694,21.8673735745303
    yinc = -0.01

Now CDO can extract the data. But now the problem is that grid structure has shifted its position and shape.

So please let me know how to change gridtype to lonlat without changing the position of the grid structure


Replies (1)

RE: regriding - Added by Karin Meier-Fleischer over 6 years ago

Hi Kunal,

ncdump shows that the coordinates variables are missing in your data file:

ncdump -h maiactaotE.h00v02.20010040635-20011550640.nc 

netcdf maiactaotE.h00v02.20010040635-20011550640 {
dimensions:
    time = UNLIMITED ; // (3 currently)
    YDim_grid1km = 1200 ;
    XDim_grid1km = 1200 ;
variables:
    double time(time) ;
        time:units = "hours since 2000-01-01 00:00:00" ;
        time:calendar = "standard" ;
    double lat(YDim_grid1km, XDim_grid1km) ;
        lat:projection = "Albers Conical Equal_Area" ;
        lat:corners = 32.0383879015429, 34.9985549202943, 24.5580030404694, 21.8673735745303 ;
        lat:long_name = "latitude" ;
        lat:units = "degrees_north" ;
    double lon(YDim_grid1km, XDim_grid1km) ;
        lon:projection = "Albers Conical Equal_Area" ;
        lon:corners = 64.23634233372, 76.8178669755364, 79.4747290253718, 68.0771493550491 ;
        lon:long_name = "longitude" ;
        lon:units = "degrees_east" ;
    short Optical_Depth_055_grid1km(time, YDim_grid1km, XDim_grid1km) ;
        Optical_Depth_055_grid1km:coordinates = "GridLat_grid1km, GridLon_grid1km" ;
        Optical_Depth_055_grid1km:hdfeos_name = "Optical_Depth_055" ;
        Optical_Depth_055_grid1km:projection = "Albers Conical Equal_Area" ;
        Optical_Depth_055_grid1km:valid_range = -100s, 5000s ;
        Optical_Depth_055_grid1km:_FillValue = -28672s ;
        Optical_Depth_055_grid1km:unit = "None" ;
        Optical_Depth_055_grid1km:add_offset = 0. ;
        Optical_Depth_055_grid1km:scale_factor = 0.001 ;
        Optical_Depth_055_grid1km:long_name = "AOT at 0.55 micron" ;

// global attributes:
        :creation_date = "Mon Nov  6 18:39:38 IST 2017" ;
        :Conventions = "None" ;
        :NCL_version = "Any version of NCL >= 5.2.0 (4/2010)" ;
        :source_file = "MAIACTAOT HDF-EOS files" ;
        :title = "MAIACTAOT HDF-EOS: time dimension added to selected variables" ;
        :history = "Mon Nov  6 22:53:15 2017: ncatted -a coordinates,Optical_Depth_055_grid1km,c,c,lon lat maiactaotE.h00v02.20010040635-20011550640.nc" ;
        :NCO = "4.6.7" ;
}

GridLat_grid1km, GridLon_grid1km is missing in the file.

If I set the coordinates to the included lat and lon variables:

ncatted -O -a coordinates,Optical_Depth_055_grid1km,o,c,"lat lon" $infile tmp.nc

and remap the data using the following grid file:

gridfile.txt:

gridtype  = lonlat
gridsize  = 1440000
xsize     = 1200
ysize     = 1200
xname     = lon
xlongname = "longitude" 
xunits    = "degrees_east" 
yname     = lat
ylongname = "latitude" 
yunits    = "degrees_north" 
xfirst    = 60.0
xinc      = 0.02
yfirst    = 18.0
yinc      = 0.02

cdo remapbil,gridfile.txt tmp.nc result.nc

This will take some time but you can make it faster using the -P option.

-Karin

    (1-1/1)