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 seldate
command.grid
: The grid name used in thecdo remapcon
command.landmask
: A boolean parameter (true
orfalse
) that restricts grid points to land.logscale
: A boolean parameter (true
orfalse
) that converts variables to log scale.lonlatbox
: Longitude and latitude limits used in thecdo sellonlatbox
command 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 selname
command.-
regions
: The filename defining a region used in thecdo maskregion
command. -
refdate
: The start and end dates for the climatological mean used in thecdo seldate
command.
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
CONFIGFILE
file can be found in theconfigs/
folder of this repository. - Examples of
regions
files can be found in theregions/
folder of this respository.