Get anomalies
The get_anom.sh script is used to obtain anomalies for multiple files. It reads parameters from a configuration file and applies them to the input files to generate anomalies. The anomalies are saved in a subfolder named anom/ within the input file's folder, with anom_ prepended to the input file's name. Additionally, the corresponding climatological mean fields are saved in a subfolder named anom/mean/, with mean_ prepended to the input file's name.
Usage
./get_anom.sh CONFIGFILE INFILES
Arguments
CONFIGFILE: Shell script that defines the parameters.INFILES: One or more input netCDF files for which anomalies will be obtained.
Configuration file
The CONFIGFILE provides the parameters required for anomaly creation. The following parameters are used by the script:
date: The start and end dates for the anomalies in the formatstartdate,enddate. Used in thecdo seldatecommand.grid: The grid name used in thecdo remapconcommand.landmask: A boolean parameter (trueorfalse) that restricts grid points to land.logscale: A boolean parameter (trueorfalse) that converts variables to log scale.lonlatbox: Longitude and latitude limits used in thecdo sellonlatboxcommand in the formatlongitude_min,longitude_max,latitude_min,latitude_max.min: The minimum value used for log scale conversion.names: Variable name(s) used in thecdo selnamecommand.-
regions: The filename defining a region used in thecdo maskregioncommand. -
refdate: The start and end dates for the climatological mean used in thecdo seldatecommand.
Output
- The anomalies are saved in a subfolder named
anom/within the input file's folder, withanom_prepended to the input file's name. - The corresponding climatological mean fields are saved in a subfolder named
anom/mean/, withmean_prepended to the input file's name.
Example
Here's an example to illustrate the usage of the get_anom.sh script:
Suppose we have the following configuration file named config.sh:
date="1850-01-01,2014-12-31"
grid="global_1"
landmask=false
logscale=false
lonlatbox="-180,180,-90,90"
min=
names="sst"
regions=
refdate="1900-01-01,1999-12-31"
And we want to create anomalies for all netCDF files in path/to/files/*.nc.
To execute the script with the given configuration file and input files, we run the following command:
./get_anom.sh config.sh path/to/files/*.nc
The script reads the parameters from config.sh and process the input files accordingly. Anomalies will be saved in the
path/to/files/anom/ subfolder, with anom_ prepended to the original file names. The corresponding climatological
mean fields will be saved in the path/to/files/anom/mean/ subfolder, with mean_ prepended to the original file
names.
Note
- Examples of
CONFIGFILEfile can be found in theconfigs/folder of this repository. - Examples of
regionsfiles can be found in theregions/folder of this respository.