Changes between Version 1 and Version 2 of Documentation/UserGuide/Ferret


Ignore:
Timestamp:
07/01/14 16:16:45 (7 years ago)
Author:
luyssaert
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Documentation/UserGuide/Ferret

    v1 v2  
    1 If you want to change the resolution of a file, ferret is a good choice. 
    2  
    3 Here are the steps for creating a one degree global map from a higher resolution. 
    4  
    5 The original script is taken from Matt Mcgrath: 
     1If 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: 
    62 
    73[[BR]] 
    84 
     5You 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. 
    96 
    10 # You need to do this in two steps.  First, open up the 
     7open ferret 
     8{{{ 
     9> ferret 
     10yes? use cartepente2d_15min.nc 
     11}}} 
    1112 
    12 # file, create a new grid, regrid, and save.  Then 
     13ORCHIDEE is case sensitive, so we need to output the variables in lower case 
    1314 
    14 # you have to do it again, but this time using the longitude and 
     15{{{ 
     16yes? CANCEL MODE upcase_output 
     17}}} 
    1518 
    16 # latitude names for the axis.  If you do it in one step, the 
     19this 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' 
    1720 
    18 # map gets distorted. 
     21{{{ 
     22yes? DEFINE AXIS/X=179.5W:179.5E:1/UNIT=degrees_east longg 
     23yes? DEFINE AXIS/Y=89.5S:89.5N:1/UNIT=degrees_north latt 
     24yes? DEFINE GRID/X=longg/Y=latt gsnoopy2d 
     25yes? SAVE/CLOBBER/FILE=regrid_pente_temp.nc pente[G=gsnoopy2d] 
     26}}} 
    1927 
    20 ### step 1 
     28now close ferret, open it again, and use regrid_pente_temp.nc 
     29{{{ 
     30yes? exit 
     31}}} 
    2132 
    22 # open ferret 
     33open ferret 
     34{{{ 
     35ferret 
     36yes? use regrid_pente_temp.nc 
     37yes? shade pente 
     38}}} 
    2339 
    24 ''ferret'' 
     40The 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 
     41{{{ 
     42ferret 
     43yes?  SET MEMORY/SIZE = 2000 
     44}}} 
    2545 
    26 ''use cartepente2d_15min.nc'' 
     46Load the file you want to use as template for the grid 
     47{{{ 
     48yes?  use regrid_height_05.nc 
     49}}} 
    2750 
    28 # ORCHIDEE is case sensitive, so we need to output the 
     51Load the file you want to regrid 
     52{{{ 
     53yes? use googleNCDF.nc 
     54}}} 
    2955 
    30 # variables in lower case 
     56Regrid 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 
     57{{{ 
     58yes? let TREEHEIGHT = ORIGINALHEIGHT[G=TEMPLATEHEIGHT[d=1]@LIN] 
     59yes? save /file=regrid_height_lin_05.nc TREEHEIGHT 
     60}}} 
    3161 
    32 ''CANCEL MODE upcase_output'' 
    33  
    34 # this creates a grid that is 360x180 
    35  
    36 # 
    37  
    38 # the name of the dimension lon and lat need 
    39  
    40 # to be different from the original file 
    41  
    42 # 
    43  
    44 # 'pente' is the name of the selected variable 
    45  
    46 # 
    47  
    48 # the new name for the longitude is 'longg' 
    49  
    50 # the new name for the latitude  is 'latt' 
    51  
    52 ''DEFINE AXIS/X=179.5W:179.5E:1/UNIT=degrees_east longg'' 
    53  
    54 ''DEFINE AXIS/Y=89.5S:89.5N:1/UNIT=degrees_north latt'' 
    55  
    56 ''DEFINE GRID/X=longg/Y=latt gsnoopy2d'' 
    57  
    58 ''SAVE/CLOBBER/FILE=regrid_pente_temp.nc pente[G=gsnoopy2d]'' 
    59  
    60  
    61 # now close ferret, open it again, and use regrid_pente_temp.nc 
    62  
    63 ''exit'' 
    64  
    65 ### step 2 
    66  
    67 # open ferret 
    68  
    69 ''ferret'' 
    70  
    71 ''use regrid_pente_temp.nc'' 
    72  
    73 ''CANCEL MODE upcase_output'' 
    74  
    75 ''DEFINE AXIS/X=179.5W:179.5E:1/UNIT=degrees_east longitude'' 
    76  
    77 ''DEFINE AXIS/Y=89.5S:89.5N:1/UNIT=degrees_north latitude'' 
    78  
    79 ''DEFINE GRID/X=longitude/Y=latitude gsnoopy2d'' 
    80  
    81 ''SAVE/CLOBBER/FILE=regrid_pente.nc pente[G=gsnoopy2d]'' 
    82  
    83  
    84 # the new file 'regrid_pente.nc' in 1° is created 
     62Be patient it can take a while to complete. Have a look at the regridded map, zoom over Europe and plot the land-sea borders  
     63{{{ 
     64yes? shade /X=-10:30e /Y=35:75n TREEHEIGHT; go land 
     65}}}