SCRIP User Guide - SCRIP-Project/SCRIP GitHub Wiki
SCRIP Quick User's Guide
A more complete user and reference guide is included as part of the distribution with a pdf attached here..
Building SCRIP
These instructions assume you have checked out a version of SCRIP from the repository.
To compile and run SCRIP, you need to first set three environment variables: SCRIPDIR, SCRIPEXEDIR, SCRIPARCH.
- SCRIPDIR pathToTopLevelScripDir
- SCRIPEXEDIR locationOfSCRIPExecutable
- SCRIPARCH myArch.gnu
The SCRIPDIR environment variable should be set to the top level SCRIP directory where you checked out SCRIP. This environment variable tells the build system that it can find the build and source directories as subdirectories of this parent. The SCRIPEXEDIR tells SCRIP where you want the executable. It is acceptable and encouraged to use the current directory (i.e. ".") for this variable, assuming you will run SCRIP interactively while in this directory. You should create the executable directory using the setupTargetDir script as described below. The SCRIPARCH should be set to correspond to a file in the build directory that is appropriate for your OS and compiler. Some sample files (e.g. linuxabsoft_serial.gnu) are provided for compilers that we have tried, but you will need to either edit an existing file to define the proper netCDF paths or create a new file based on your local environment. There are relatively few options to change in these files, so it should be straightforward to create one for your system. The SCRIPARCH variable should be set to the root filename of the .gnu file (e.g. linuxabsoft_serial). Currently, SCRIP only works in serial mode, so keep the MPI settings in the .gnu file set to no.
In order to compile SCRIP, you need access to a Fortran 90 compiler and a netCDF library with the F90 interfaces. In the top level of the SCRIP directory where you checked out SCRIP, you will find a script called setupTargetDir. You should run this script using
setupTargetDir directoryName where directoryName is the name of a directory from which you are planning to run SCRIP. This script copies required makefiles and also creates two subdirectories (test and testRepeat) for running the SCRIP test codes that are supplied with the distribution.
Once you have done all this, you should be able to type "gmake" (or make if your OS has a GNU make compliant make command) in the SCRIPEXEDIR and the build system should do the rest. It will create an executable called scrip. The next section will tell you how to run this executable.
Running SCRIP
Generating the remapping
SCRIP requires a single input file named scrip_in. This file contains a list of options in namelist format as shown below:
&remapInputs
num_maps = 2
gridFile1 = '../grids/remap_grid_POP43.nc'
gridFile2 = '../grids/remap_grid_T42.nc'
interpFile1 = 'rmp_POP43_to_T42_conserv.nc'
interpFile2 = 'rmp_T42_to_POP43_conserv.nc'
mapName1 = 'POP43 to T42 Conservative Mapping'
mapName2 = 'T42 to POP43 Conservative Mapping'
mapMethod = 'conservative'
normalizeOpt = 'fracArea'
outputFormat = 'scrip'
restrict_type = 'latitude'
num_srch_bins = 90
luse_grid1_area = .false.
luse_grid2_area = .false.
/
We describe each of these below with the values in brackets as examples or acceptable choices.
- num_maps {1,2} Use 1 for a single remapping from grid1 to grid2; Use 2 if remappings in both directions are desired
- gridFile1: {'grid1FileName.nc'} : Name (with path) of the file containing the grid information for grid1. Grid1 is assumed to be the source grid for the first remapping. Relative paths are ok.
- **gridFile2 'grid2FileName.nc' Name (with path) of the file containing the grid information for grid2. Grid2 is assumed to be the destination grid for the first remapping.
- interpFile1: {'remapFileName1.nc'} : Name (with path) of the file where the resulting regridding information is to be written for the first remapping.
- interpFile2: {'remapFileName2.nc'} : Same as above,but for a second remapping if requested.
- mapName1: {'Name of Mapping 1'} : Name to be assigned to the first remapping. The name should ideally include the grid pair and the method used (e.g. 'T42 to POPx1g3 Conservative Remapping').
- mapName2: {'Name of Mapping 2'} : Same as above, but for a second remapping if requested
- mapMethod: {'conservative', 'bilinear', 'bicubic', 'distwgt', 'particle'} : Method to be used for computing remapping between the two grids.
- normalizeOpt: {'none', 'fracArea', 'dstArea'} : For conservative methods, this refers to whether the area overlaps that comprise the weights are normalized by the full destination area (dstArea) or by the fractional area of the destination grid that is participating in the remapping ('dstArea'). The latter is often used if the intent is to eventually multiply by the fraction later as part of a merging of two values, e.g. for land/ocean.
- outputFormat: {'scrip','ncar-csm'} : This refers to the naming convention used in the remapping file. The SCRIP format uses names like 'add1, add2, wts' for the regrid variables. The NCAR CCSM flux coupler assumes the names are generic names for a sparse matrix mult utility (e.g. the weight array is simply named 'S').
- restrict_type: {'latitude','latlon'} : When searching the grids, SCRIP can first create search bins based either on a latitude range ('latitude') or rectangular boxes in lat-lon space ('latlon').
- num_srch_bins: {90 (any int > 0)} : The number of bins to use in the above search. Larger number of bins can restrict the later detailed grid search, but requires more memory. Too many bins is counter-productive in the sense that it becomes close to a full grid search if only one cell is in a bin. Finally, if using the latlon option, this refers to the number of bins in each direction (so the actual number is num_srch_bins squared).
- luse_grid1_area: {.false.} : For conservative regridding, the area computed by SCRIP may be different from the area used in the application code based on a more accurate area calculation. This flag will renormalize the SCRIP-computed areas to conform to the user-computed grid cell areas.
- luse_grid2_area: {.false.} : Same as above, but for the second grid.
Once you have edited the scrip_in file for your desired options, simply type scrip and it will generate the remapping information and store it in the specified files for later use.