Changes between Version 1 and Version 2 of Documentation/UserGuide/Ferret
- Timestamp:
- 2014-07-01T16:16:45+02:00 (10 years ago)
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: 1 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: 6 2 7 3 [[BR]] 8 4 5 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. 9 6 10 # You need to do this in two steps. First, open up the 7 open ferret 8 {{{ 9 > ferret 10 yes? use cartepente2d_15min.nc 11 }}} 11 12 12 # file, create a new grid, regrid, and save. Then 13 ORCHIDEE is case sensitive, so we need to output the variables in lower case 13 14 14 # you have to do it again, but this time using the longitude and 15 {{{ 16 yes? CANCEL MODE upcase_output 17 }}} 15 18 16 # latitude names for the axis. If you do it in one step, the 19 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' 17 20 18 # map gets distorted. 21 {{{ 22 yes? DEFINE AXIS/X=179.5W:179.5E:1/UNIT=degrees_east longg 23 yes? DEFINE AXIS/Y=89.5S:89.5N:1/UNIT=degrees_north latt 24 yes? DEFINE GRID/X=longg/Y=latt gsnoopy2d 25 yes? SAVE/CLOBBER/FILE=regrid_pente_temp.nc pente[G=gsnoopy2d] 26 }}} 19 27 20 ### step 1 28 now close ferret, open it again, and use regrid_pente_temp.nc 29 {{{ 30 yes? exit 31 }}} 21 32 22 # open ferret 33 open ferret 34 {{{ 35 ferret 36 yes? use regrid_pente_temp.nc 37 yes? shade pente 38 }}} 23 39 24 ''ferret'' 40 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 41 {{{ 42 ferret 43 yes? SET MEMORY/SIZE = 2000 44 }}} 25 45 26 ''use cartepente2d_15min.nc'' 46 Load the file you want to use as template for the grid 47 {{{ 48 yes? use regrid_height_05.nc 49 }}} 27 50 28 # ORCHIDEE is case sensitive, so we need to output the 51 Load the file you want to regrid 52 {{{ 53 yes? use googleNCDF.nc 54 }}} 29 55 30 # variables in lower case 56 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 57 {{{ 58 yes? let TREEHEIGHT = ORIGINALHEIGHT[G=TEMPLATEHEIGHT[d=1]@LIN] 59 yes? save /file=regrid_height_lin_05.nc TREEHEIGHT 60 }}} 31 61 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 62 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 63 {{{ 64 yes? shade /X=-10:30e /Y=35:75n TREEHEIGHT; go land 65 }}}