1. summary: conservative mappings between gx1v3 and T62 2. created by: Matthew Hecht 3. date and time: Feb 28, 2002 4. created on: dataproc 5. dataset format: nc 6. endian: n/a 7. archival copy location: /CCSM/mapping/maps 8. creation summary: The following is a deSCRIPtion of how one would produce a netcdf mapping file between gx1v3 and T62 grids. You may wish to replace these grid names in the following and then make use of copy-paste to produce grid files and/or weights. ----------- -- Setup -- ----------- Copy SCRIP from most recent scrip directory, under /fs/cgd/csm/mapping In grids/convert[POPT, gauss, etc.].f Edit nx, ny, grid_name, and grid_file_out. Any other edits? make In source subdir, make scrip ----------- -- Grids -- ----------- Note: As of November 2001 we are not using the standard scrip1.4 version of convertPOPT, but have nonstandard code to use the ccsm_pop/cice calculation of T-grid cell center locations, and we use Keith's nonstd calculation of southern-most points. I'm getting this code from /fs/cgd/home0/hecht/csm/fortran/SCRIP/scrip1.4/grids/convertPOPT.f This file is under revision control, in /home/hecht/my_cvs/SCRIP/scrip1.4/grids/convertPOPT.f,v Note also that there was a (harmless, it seems) bug in this nonstandard version of convertPOPT.f, affecting the grid coordinates in the (unused) j=1 row. This is why these maps are being regenerated today. The diffs between buggy -r1.3 code and bug-fixed code are: *** 306,313 **** n = 0 do i=1,nx n = n + 1 ! np1 = n + ny ! np2 = n + 2*ny grid_center_lon(n) = grid_center_lon(np1) grid_center_lat(n) = 2.0*grid_center_lat(np1) - $ grid_center_lat(np2) --- 306,313 ---- n = 0 do i=1,nx n = n + 1 ! np1 = n + nx ! np2 = n + 2*nx grid_center_lon(n) = grid_center_lon(np1) grid_center_lat(n) = 2.0*grid_center_lat(np1) - $ grid_center_lat(np2) --- In grids subdir, produce gx1v3_020228.nc from: convertPOPT Add documentation: ncatted -O -h -a Created_by,global,a,c,"`whoami`, `date`" gx1v3_020228.nc ncatted -O -h -a 1D_grid_indexing,global,a,c,"if n is 1D index, i runs fast, j runs slow: n=(j-1)*fast_grid_dim+i" gx1v3_020228.nc ----------- -- Scrip -- ----------- In SCRIP directory, write scrip_in: cat >! scrip_in &remap_inputs num_maps = 2 grid1_file = '/fs/cgd/csm/mapping/grids/gx1v3_020228.nc' grid2_file = '/fs/cgd/csm/mapping/grids/T62.nc' interp_file1 = 'map_gx1v3_to_T62_aave_da_020228.nc' interp_file2 = 'map_T62_to_gx1v3_aave_da_020228.nc' map1_name = 'gx1v3 to T62 Mapping' map2_name = 'T62 to gx1v3 Mapping' map_method = 'conservative' normalize_opt = 'destarea' output_opt = 'ncar-csm' restrict_type = 'latlon' num_srch_bins = 10 / Note that the grid files should come from the standard CCSM location (/fs/cgd/csm/mapping/grids/) unless the grid is untested (see below for the testing procedure which is recommended at this point in time). Run scrip: scrip > map_gx1v3_and_T62_aave_da_020228.out ------------------------ -- Testing of Weights -- ------------------------ -- Verified that weights were absolutely unchanged by bug-fix: ncks -H -v S /fs/cgd/csm/mapping/maps/map_T62_to_gx1v3_aave_da_011025.nc \ >! S_011025.dat ncks -H -v S map_T62_to_gx1v3_aave_da_020228.nc >! S_020228.dat diff S_011025.dat S_020228.dat -- Run ferret and check stats of both maps (see that min value is not substantially below zero): set data map_T62_to_gx1v3_aave_da_020228.nc stats s set data map_gx1v3_to_T62_aave_da_020228.nc stats s -- Run scrip_test for T62_to_gx1v3: In SCRIP directory, write scrip_test_in: cat >! scrip_test_in &remap_inputs field_choice = 2 interp_file = 'map_T62_to_gx1v3_aave_da_020228.nc' output_file = 'test_T62_to_gx1v3_aave_da_020228.nc' / scrip_test > ! test_T62_to_gx1v3_aave_da_020228.out Inspect output netcdf file out[...].nc file with ferret. Append some of the output of scrip_test to the map file, documenting error field: 1) copy the output from scrip_test to tmp file called foo 2) edit foo, saving FIELD_CHOICE and all lines from First order mapping from grid1 to grid2: on down. 3) replace each end-of-line with \n 4) append this business as a global ncdf attribute: ncatted -O -h -a scrip_test_output,global,a,c,"`cat foo`" \ map_T62_to_gx1v3_aave_da_020228.nc -- Run scrip_test for gx1v3_to_T62: In SCRIP directory, write scrip_test_in: cat >! scrip_test_in &remap_inputs field_choice = 2 interp_file = 'map_gx1v3_to_T62_aave_da_020228.nc' output_file = 'test_gx1v3_to_T62_aave_da_020228.nc' / scrip_test > ! test_gx1v3_to_T62_aave_da_020228.out Inspect output netcdf file out[...].nc file with ferret. Append some of the output of scrip_test to the map file, documenting error field: 1) copy the output from scrip_test to tmp file called foo 2) edit foo, saving FIELD_CHOICE and all lines from First order mapping from grid1 to grid2: on down. 3) replace each end-of-line with \n 4) append this business as a global ncdf attribute: ncatted -O -h -a scrip_test_output,global,a,c,"`cat foo`" \ map_gx1v3_to_T62_aave_da_020228.nc ------------------------------ -- Consistency of Grid Data -- ------------------------------ If this is not the first mapping file produced for this ocean (ice) grid, then check that the grid info included in the map.nc file agrees with that from existing files. ------------- -- Caution -- ------------- Brian has some test code built into the coupler that 1) checks that array elements are in [0,1] 2) checks that array rows add up to one (or zero for masked out regions) 3) checks what percent of array rows add up to one (eg. a->o should be about 70%) 4) checks that SCRIP domain info is compatible with info sent to cpl at run time. For now, this information must be inspected the first time a map is used by the cpl. In the near future we will have stand-alone code to do this. --------------- -- Finish up -- --------------- If mappings are ok then, again, add documentation: ncatted -O -h -a Created_by,global,a,c,"`whoami`, `date`" map_T62_to_gx1v3_aave_da_020228.nc ncatted -O -h -a 1D_grid_indexing,global,a,c,"if n is 1D index, i runs fast, j runs slow: n=(j-1)*fast_grid_dim+i" map_T62_to_gx1v3_aave_da_020228.nc ncatted -O -h -a Created_by,global,a,c,"`whoami`, `date`" map_gx1v3_to_T62_aave_da_020228.nc ncatted -O -h -a 1D_grid_indexing,global,a,c,"if n is 1D index, i runs fast, j runs slow: n=(j-1)*fast_grid_dim+i" map_gx1v3_to_T62_aave_da_020228.nc and install in /fs/cgd/csm/mapping/maps: mv map_T62_to_gx1v3_aave_da_020228.nc /fs/cgd/csm/mapping/maps chgrp cgdcsm /fs/cgd/csm/mapping/maps/map_T62_to_gx1v3_aave_da_020228.nc chmod 444 /fs/cgd/csm/mapping/maps/map_T62_to_gx1v3_aave_da_020228.nc cp map_T62_to_gx1v3_aave_da_020228.readme /fs/cgd/csm/mapping/maps chgrp cgdcsm /fs/cgd/csm/mapping/maps/map_T62_to_gx1v3_aave_da_020228.readme chmod 444 /fs/cgd/csm/mapping/maps/map_T62_to_gx1v3_aave_da_020228.readme mv map_gx1v3_to_T62_aave_da_020228.nc /fs/cgd/csm/mapping/maps chgrp cgdcsm /fs/cgd/csm/mapping/maps/map_gx1v3_to_T62_aave_da_020228.nc chmod 444 /fs/cgd/csm/mapping/maps/map_gx1v3_to_T62_aave_da_020228.nc ln -s /fs/cgd/csm/mapping/maps/map_T62_to_gx1v3_aave_da_020228.readme \ /fs/cgd/csm/mapping/maps/map_gx1v3_to_T62_aave_da_020228.readme