Project

General

Profile

Reproject Gaussian to Sinusoidal

Added by thomas lees about 5 years ago

Dear CDO world.

I am trying to reproject FROM a Gaussian grid TO a Sinusoidal Grid.

I have been reading the documentation (1.3.2.4. CDO grids) - https://code.mpimet.mpg.de/projects/cdo/embedded/index.html.

However, there are no examples I am aware of which take a gaussian grid and convert them to a modis_projection.

What I want is to go FROM:
(ERA TEST DATA)

ncdump
```
netcdf ERAIN_SFC00_6H_2mtemperature_1999 {
dimensions:
lon = 512 ;
lat = 256 ;
time = UNLIMITED ; // (1460 currently)
variables:
double lon(lon) ;
lon:long_name = "longitude" ;
lon:units = "degrees_east" ;
lon:standard_name = "longitude" ;
lon:axis = "X" ;
double lat(lat) ;
lat:long_name = "latitude" ;
lat:units = "degrees_north" ;
lat:standard_name = "latitude" ;
lat:axis = "Y" ;
double time(time) ;
time:standard_name = "time" ;
time:units = "days since 1-01-01 00:00:00" ;
time:calendar = "proleptic_gregorian" ;
short temperature2m(time, lat, lon) ;
temperature2m:long_name = "2m temperature" ;
temperature2m:units = "K" ;
temperature2m:scale_factor = 0.01f ;
temperature2m:add_offset = 273.15f ;

// global attributes:
:content = "ERA INTERIM data of var167; converted from grb to netCDF with CDOs; converted time array to proleptic calendar; compressed data to short" ;
:history = "created on Sun, 19 Feb 2012 20:05:55 UTC by MPI-M TRS group" ;
}
```

TO:

```
netcdf ERAIN_SFC00_6H_2mtemperature_2000.nc {
dimensions:
x = 512 ;
y = 256 ;
time = UNLIMITED ; // (1464 currently)
variables:
double time(time) ;
time:standard_name = "time" ;
time:units = "days since 1-01-01 00:00:00" ;
time:calendar = "proleptic_gregorian" ;
short temperature2m(time, y, x) ;
temperature2m:long_name = "2m temperature" ;
temperature2m:units = "K" ;
temperature2m:add_offset = 273.15f ;
temperature2m:scale_factor = 0.01f ;
double latitude(y, x) ;
latitude:_FillValue = -99999. ;
double longitude(y, x) ;
longitude:_FillValue = -99999. ;
}
```

NOTE

I have tried doing such a translation with GDAL but the problem is the .netcdf file structure is ruined and the 'time' dimension becomes a load of bands. (see out.nc)

```
$ gdalwarp -t_srs "+proj=sinu +R=6371007.181 +nadgrids=@null +wktext" ERA_test.nc out.nc

netcdf out {
dimensions:
x = 512 ;
y = 256 ;
variables:
short Band1(y, x) ;
Band1:long_name = "GDAL Band Number 1" ;
Band1:_FillValue = -32767s ;
Band1:grid_mapping = "sinusoidal" ;
Band1:units = "K" ;
short Band2(y, x) ;
Band2:long_name = "GDAL Band Number 2" ;
Band2:_FillValue = -32767s ;
Band2:grid_mapping = "sinusoidal" ;
Band2:units = "K" ;
short Band3(y, x) ;
Band3:long_name = "GDAL Band Number 3" ;
Band3:_FillValue = -32767s ;
Band3:grid_mapping = "sinusoidal" ;
Band3:units = "K" ;
short Band4(y, x) ;
Band4:long_name = "GDAL Band Number 4" ;
Band4:_FillValue = -32767s ;
Band4:grid_mapping = "sinusoidal" ;
Band4:units = "K" ;
short Band5(y, x) ;
Band5:long_name = "GDAL Band Number 5" ;
Band5:_FillValue = -32767s ;
Band5:grid_mapping = "sinusoidal" ;
Band5:units = "K" ;
char sinusoidal ;
sinusoidal:grid_mapping_name = "sinusoidal" ;
sinusoidal:false_easting = 0. ;
sinusoidal:false_northing = 0. ;
sinusoidal:longitude_of_central_meridian = 0. ;
sinusoidal:long_name = "CRS definition" ;
sinusoidal:longitude_of_prime_meridian = 0. ;
sinusoidal:semi_major_axis = 6371007.181 ;
sinusoidal:inverse_flattening = 0. ;
```

ERA_test.nc (1.27 MB) ERA_test.nc THE INPUT DATA that want to change to sinusoidal projection
out.nc (1.26 MB) out.nc My attempt when using GDAL

Replies (5)

RE: Reproject Gaussian to Sinusoidal - Added by Karin Meier-Fleischer about 5 years ago

Hi Thomas,

if you have a modis (sinusoidal) file you can use it for remapping, see https://code.mpimet.mpg.de/projects/cdo/wiki/FAQ#How-can-I-remap-my-data-to-a-different-grid-of-another-data-file.

Assume modis.nc contains the modis grid information, the following command should remap your data to the wanted grid.

cdo -remapycon,modis.nc ERA_test.nc ERA_test_modis.nc
-Karin

RE: Reproject Gaussian to Sinusoidal - Added by thomas lees about 5 years ago

Thanks Karin that's very helpful! Do you know of where i can download a global netcdf file of data that is modis projected? Just in case you have one spare it would be super useful!

I can't currently find a `modis.nc` with the correct grid.

Thanks

Tommy

RE: Reproject Gaussian to Sinusoidal - Added by Karin Meier-Fleischer about 5 years ago

I'm sorry, but I don't have a MODIS file. Maybe you can get one at https://modis-land.gsfc.nasa.gov/MODLAND_grid.html.

-Karin

RE: Reproject Gaussian to Sinusoidal - Added by David Crowhurst about 5 years ago

Hi Karin,

Do you know how to use CDO to convert a netcdf file with MODIS sinusoidal projection to a regular lat/lon grid (e.g. WGS84)?

Best wishes,
David.

RE: Reproject Gaussian to Sinusoidal - Added by Karin Meier-Fleischer about 5 years ago

It is easy to remap a MODIS file to rectilinear latlon grid. Let us say you want to remap the data to a 360x180 lon/lat grid:

cdo remapycon2,r360x180 infile outfile

I don't think that we have a special WGS84 remapping depending on a given reference ellipsoid.

-Karin

    (1-5/5)