1. summary: conservative mappings between gx3v4 and finite volume 2x2.5 degree grid 2. created by: Gary Strand 3. date and time: 11 Dec 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 gx3v4 and fv_2x25d 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 Copied SCRIP from these directories: (/fs/cgd/data0/hecht/mapping/scrip1.4/grids) (/fs/cgd/data0/hecht/mapping/scrip1.4/source) 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 This didn't work. So linked to Hecht's executables: /fs/cgd/data0/hecht/mapping/scrip1.4/scrip /fs/cgd/data0/hecht/mapping/scrip1.4/scrip_test ----------- -- 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 gx3v4_020513.nc from: convertPOPT Add documentation: ncatted -O -h -a Created_by,global,a,c,"`whoami`, `date`" gx3v4_020513.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" gx3v4_020513.nc ----------- -- Scrip -- ----------- In SCRIP directory, write scrip_in: cat >! scrip_in &remap_inputs num_maps = 2, grid1_file = '/fs/cgd/csm/mapping/grids/gx3v4_020513.nc', grid2_file = '/fs/cgd/data0/strandwg/SCRIP/grids/remap_grid_2x25d.nc' interp_file1 = 'map_gx3v4_to_2x25d_aave_da.nc', interp_file2 = 'map_2x25d_to_gx3v4_aave_da.nc', map1_name = 'gx3v4 to finite volume 2x25d conservative', map2_name = 'finite volume 2x25d to gx3v4 conservative', 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: ln -s /fs/cgd/data0/hecht/mapping/scrip1.4/scrip scrip ln -s /fs/cgd/data0/hecht/mapping/scrip1.4/scrip_test scrip_test scrip > map_gx3v4_and_2x25d_aave_da.out ------------------------ -- Testing of Weights -- ------------------------ -- Run ferret and check stats of both maps (see that min value is not substantially below zero): set data map_2x25d_to_gx3v4_aave_da.nc stats s S X: 0.5 to 36008.5 Y: N/A Z: N/A T: N/A DATA SET: ./map_2x25d_to_gx3v4_aave_da.nc Total # of data points: 36008 (36008*1*1*1) # flagged as bad data: 0 Minimum value: -5.035E-06 Maximum value: 0.92344 Mean value: 0.22289 (unweighted average) Standard deviation: 0.19967 set data map_gx3v4_to_2x25d_aave_da.nc stats s S X: 0.5 to 36008.5 Y: N/A Z: N/A T: N/A DATA SET: ./map_gx3v4_to_2x25d_aave_da.nc Total # of data points: 36008 (36008*1*1*1) # flagged as bad data: 0 Minimum value: -0.00025893 Maximum value: 1 Mean value: 0.23902 (unweighted average) Standard deviation: 0.21285 -- Run scrip_test for 2x25d_to_gx3v4: In SCRIP directory, write scrip_test_in: cat >! scrip_test_in &remap_inputs field_choice = 2 interp_file = 'map_2x25d_to_gx3v4_aave_da.nc' output_file = 'test_2x25d_to_gx3v4_aave_da.nc' / scrip_test > ! test_2x25d_to_gx3v4_aave_da.out Inspect output netcdf file out[...].nc file with ferret. yes? set data out_2x25d_to_gx3v4_aave_da.nc yes? shade src_array yes? shade dst_array1 yes? shade dst_error1 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_2x25d_to_gx3v4_aave_da.nc -- Run scrip_test for gx3v4_to_2x25d: In SCRIP directory, write scrip_test_in: cat >! scrip_test_in &remap_inputs field_choice = 2 interp_file = 'map_gx3v4_to_2x25d_aave_da.nc' output_file = 'test_gx3v4_to_2x25d_aave_da.nc' / scrip_test > ! test_gx3v4_to_2x25d_aave_da.out Inspect output netcdf file out[...].nc file with ferret. set data test_gx3v4_to_2x25d_aave_da.nc shade src_array shade dst_array1 shade dst_error1 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_gx3v4_to_2x25d_aave_da.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_2x25d_to_gx3v4_aave_da.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_2x25d_to_gx3v4_aave_da.nc ncatted -O -h -a Created_by,global,a,c,"`whoami`, `date`" map_gx3v4_to_2x25d_aave_da.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_gx3v4_to_2x25d_aave_da.nc and to be installed in /fs/cgd/csm/mapping/maps: (do later) mv map_2x25d_to_gx3v4_aave_da.nc /fs/cgd/csm/mapping/maps chgrp cgdcsm /fs/cgd/csm/mapping/maps/map_2x25d_to_gx3v4_aave_da.nc chmod 444 /fs/cgd/csm/mapping/maps/map_2x25d_to_gx3v4_aave_da.nc mv map_2x25d_to_gx3v4_aave_da.readme /fs/cgd/csm/mapping/maps chgrp cgdcsm /fs/cgd/csm/mapping/maps/map_2x25d_to_gx3v4_aave_da.readme chmod 444 /fs/cgd/csm/mapping/maps/map_2x25d_to_gx3v4_aave_da.readme mv map_gx3v4_to_2x25d_aave_da.nc /fs/cgd/csm/mapping/maps chgrp cgdcsm /fs/cgd/csm/mapping/maps/map_gx3v4_to_2x25d_aave_da.nc chmod 444 /fs/cgd/csm/mapping/maps/map_gx3v4_to_2x25d_aave_da.nc ln -s /fs/cgd/csm/mapping/maps/map_2x25d_to_gx3v4_aave_da.readme \ /fs/cgd/csm/mapping/maps/map_gx3v4_to_2x25d_aave_da.readme