How to use ferret to change the resolution of a file?

Author: J.Otto & S.Luyssaert
Last revision: 2020/03/19, J. Lathière

Note that you can also use cdo for regridding.


If you want to change the resolution of a file, ferret is a good choice. Here are the steps for creating a one degree global map from a higher resolution. The original script is taken from Matt Mcgrath.

You need to do this in two steps. First, open up the file, create a new grid, regrid, and save. Then you have to do it again, but this time using the longitude and latitude names for the axis. If you do it in one step, the map gets distorted.

Open ferret:

> ferret
yes? use

ORCHIDEE is case sensitive, so we need to output the variables in lower case:

yes? CANCEL MODE upcase_output

This creates a grid that is 360x180. The name of the dimension lon and lat need to be different from the original file. 'pente' is the name of the selected variable. The new name for the longitude is 'longg' and the new name for the latitude is 'latt'.

yes? DEFINE AXIS/X=179.5W:179.5E:1/UNIT=degrees_east longg
yes? DEFINE AXIS/Y=89.5S:89.5N:1/UNIT=degrees_north latt
yes? DEFINE GRID/X=longg/Y=latt gsnoopy2d
yes? SAVE/CLOBBER/ pente[G=gsnoopy2d]

Now close ferret:

yes? exit

To get a map of the new file, open ferret, and use

yes? use
yes? shade pente


The method described above is convenient for regular grids but not for something more fancy or if you don't know the specifications of the source grid. Here is of what you could do. Regridding big files can take some memory, therefore increase the memory allocation for ferret.

yes?  SET MEMORY/SIZE = 2000

Load the file you want to use as template for the grid:

yes?  use

Load the file you want to regrid:

yes? use

Regrid by making a temporary variable, TREEHEIGHT is the new variable, ORIGINALHEIGHT is the variable that will be regridded, TEMPLATEHEIGHT is the variable name of which the grid will be used as a template, G indicates that you will change the properties of the grid and @LIN is one of the hand full of transformations you can use when regridding (@AVE, @MAX, @MIN, @LIN, @NRST). Look on the web for a more precise description of these operators.

yes? save / TREEHEIGHT

Be patient, it can take a while to complete. Have a look at the regridded map, zoom over Europe and plot the land-sea borders:

yes? shade /X=-10:30e /Y=35:75n TREEHEIGHT; go land
Last modified 20 months ago Last modified on 05/29/20 15:24:26