Function to compute opersvarfiles: operation of variables from different files (OPER1.FILE1_VAR1 OPER2.FILE2_VAR2), operations are going to be sequentially
compute_opersvarsfiles(values, varinfo)
values= '%' separated list of dimension ranges and file,operation,variable to compute
[dimranges1]@[operfile1var]%[dimranges2]@[operfile2var]%[...[dimrangesM]@[operfileMvar]]
dimranges: ';' separated list of dimension, dimension-variable names and their ranges ('|' separated)
[dim1]|[dimv1]|[range];[dim2]|[dimv2]|[range];[...|[dimN]|[dimvN]|[range]]
with [range] as:
-1, all the values
-9, last values
int, a single value
[beg,end,frq], from a beginning to an end with a given frequency
operfilevar: [oper]|[file]|[var] '|' separated list of triplets of [operation], [file], [variable name to use]
* [oper]: operations (being [prevalues] the values computed until the operation)
'add': adding [var] ([prevalues] + [var])
'addc',[modval1]: add [modval1] to [prevalues]
'centerderiv',[N],[ord],[dim]: un-scaled center [N]-derivative of order [ord] along dimension [dim] of [var]
'div': dividing by [var] ([prevalues] / [var])
'divc',[modval1]: [prevalues] divide by [modval1]
'forwrdderiv',[N],[ord],[dim]: un-scaled forward [N]-derivative of order [ord] along dimension [dim] of [var]
'inv': inverting [prevalues] (1/[prevalues])
'lowthres',[modval1],[modval2]: if [prevalues] < [modval1]; prevalues = [modval2]
'lowthres@oper',[modval1],[oper],[modval2]: if [prevalues] < [modval1]; prevalues = [oper] (operation as [modval2])
'mul': multiplying by [var] ([prevvalues] * [var])
'mulc',[modval1]: [prevalues] multiplied by [modval1]
'pot': powering with [var] ([prevalues] ** [var])
'potc',[modval1]: [prevalues] ** [modval1]
'sub': substracting [var] ([prevalues] - [var])
'subc',[modval1]: remove [modval1] of [prevalues]
'upthres',[modval1],[modval2]: if [prevalues] > [modval1]; prevalues = [modval2]
'upthres@oper',[modval1],[oper],[modval2]: if [prevalues] > [modval1]; prevalues = [oper] (operation with [modval2])
* [file]: name of the file
* [var]: variable to use ('None' for the case with constant operations: 'addc', 'divc', 'inv', 'lowthres',
'lowthres@oper', 'mulc', 'potc', 'subc', 'upthres', 'upthres@oper'
varinfo= [varname],[Lvarname],[varunits]
varname: name of the final variable
Lvarname: long name of the final variable ('!' for spaces)
varunits: units of the final variable ('!' for spaces)
$ python ${pyHOME}/nc_var.py -o compute_opersvarsfiles -S 'west_east|XLONG|-1;south_north|XLAT|-1;Time|Times|3@add|wrfout_d01_2001-11-11_00:00:00|T2%west_east|XLONG|-1;south_north|XLAT|-1;Time|Times|3@subc,273.15|wrfout_d01_2001-11-11_00:00:00|None' -v 'tempC,air!temperature,C'
$ python ${pyHOME}/nc_var.py -o compute_opersvarsfiles -S 'lon|lon|-1;lat|lat|-1;time_counter|time_counter|-1@forwrdderiv,1,1,2|/ccc/store/cont003/gen7593/fitaborl/etudes/DynamicoESM/aquaplanet/AR40/19800101000000-19810101000000/histday.nc|t2m' -v 'tasderiv,x-derivative|of|air|temperature,K