wiki:Documentation/UserGuide/Ferret

Version 2 (modified by luyssaert, 10 years ago) (diff)

--

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 cartepente2d_15min.nc

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' 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/FILE=regrid_pente_temp.nc pente[G=gsnoopy2d]

now close ferret, open it again, and use regrid_pente_temp.nc

yes? exit

open ferret

ferret
yes? use regrid_pente_temp.nc
yes? shade pente

The method described above is convenient for regular grids but for something more fancy or if you don't the specifications of the source grid but you have an example here is what you could do. Regridding big files can take some memory increase the memeory allocation for ferret

ferret
yes?  SET MEMORY/SIZE = 2000

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

yes?  use regrid_height_05.nc

Load the file you want to regrid

yes? use googleNCDF.nc

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? let TREEHEIGHT = ORIGINALHEIGHT[G=TEMPLATEHEIGHT[d=1]@LIN]
yes? save /file=regrid_height_lin_05.nc 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