source: lmdz_wrf/trunk/tools/documentation/ncmanage/compute_opersvarsfiles.html @ 1535

Last change on this file since 1535 was 1535, checked in by lfita, 8 years ago

Improving `copute_opersvarsfiles' by:

Adding `contoperation': which is used for calculations on result of previous operations without using a variable from a file
Adding:

'arctan', arctangent [-pi, pi]
'norm_meanminmax',[NOTnormdims]: normalization of data as: (val-<val>)/(max(val)-min(val)) except along dimensions [NOTnormdims] (':' list of dimension names, or 'any' for using all dimensions)
'norm_minmax',[NOTnormdims]: normalization of data as: [2val-(max(val)-min(val)]/[max(val)+min(val)] except along dimensions [NOTnormdims] (':' list of dimension names, or 'any' for using all dimensions)
'norm_meanstd',[NOTnormdims]: normalization of data as: (val-<val>)/stdev(val) except along dimensions [NOTnormdims] (':' list of dimension names, or 'any' for using all dimensions)

File size: 8.3 KB
Line 
1<HTML>
2  <HEAD>
3    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
4    <LINK REL="stylesheet" TYPE="text/css" HREF="../PyNCplot.css"/>
5  </HEAD>
6
7  </HEAD>
8  <BODY>
9    <DIV CLASS="valheader">
10      compute_opersvarsfiles
11    </DIV>
12    <DIV CLASS="valimg">
13      Function to compute opersvarfiles: operation of variables from different files (OPER1.FILE1_VAR1 OPER2.FILE2_VAR2), operations are going to be sequentially
14    </DIV>
15    <DIV CLASS="valhelp">
16      compute_opersvarsfiles(values, varinfo)<BR>
17      &nbsp;&nbsp;NOTE: Values from the first file (with always operation 'add') <BR>
18      &nbsp;&nbsp;[prevalues]: values from the previous operations <BR>
19      &nbsp;&nbsp;values= '%' separated list of dimension ranges and file,operation,variable to compute<BR>
20      &nbsp;&nbsp;&nbsp;&nbsp;[dimranges1]@[operfile1var]%[dimranges2]@[operfile2var]%[...[dimrangesM]@[operfileMvar]]<BR>
21      &nbsp;&nbsp;&nbsp;&nbsp;dimranges: ';' separated list of dimension, dimension-variable names and their ranges ('|' separated)<BR>
22      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[dim1]|[dimv1]|[range];[dim2]|[dimv2]|[range];[...|[dimN]|[dimvN]|[range]]<BR>
23      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;with [range] as:<BR>
24      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-1, all the values<BR>
25      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-9, last values<BR>
26      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int, a single value<BR>
27      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[beg,end,frq], from a beginning to an end with a given frequency<BR>
28      &nbsp;&nbsp;&nbsp;&nbsp;operfilevar: [oper]|[file]|[var] '|' separated list of triplets of [operation], [file], [variable name to use]<BR>
29      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* [oper]: operations (being [prevalues] the values computed until the operation)<BR>
30      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'add': adding [var] ([prevalues] + [var])<BR>
31      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'addc',[modval1]: add [modval1] to [prevalues]<BR>
32      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'arctan', arctangent [-p1, pi]<BR>
33      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'centerderiv',[N],[ord],[dim]: un-scaled center [N]-derivative of order [ord] along dimension [dim] of [var]<BR>
34      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'div': dividing by [var] ([prevalues] / [var])<BR>
35      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'divc',[modval1]: [prevalues] divide by [modval1]<BR>
36      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'forwrdderiv',[N],[ord],[dim]: un-scaled forward [N]-derivative of order [ord] along dimension [dim] of [var]<BR>
37      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'inv': inverting [prevalues] (1/[prevalues])<BR>
38      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'lowthres',[modval1],[modval2]: if [prevalues] < [modval1]; prevalues = [modval2]<BR>
39      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'lowthres@oper',[modval1],[oper],[modval2]: if [prevalues] < [modval1]; prevalues = [oper] (operation as [modval2])<BR>
40      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'mul': multiplying by [var] ([prevvalues] * [var])<BR>
41      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'mulc',[modval1]: [prevalues] multiplied by [modval1]<BR>
42      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'norm_meanminmax',[NOTnormdims]: normalization of data as: (val-<val>)/(max(val)-min(val)) except along <BR>
43      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dimensions [NOTnormdims] (':' list of dimension names, or 'any' for using all dimensions)<BR>
44      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'norm_minmax',[NOTnormdims]: normalization of data as: [2val-(max(val)-min(val)]/[max(val)+min(val)]<BR>
45      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;except along dimensions [NOTnormdims] (':' list of dimension names, or 'any' for using all dimensions)<BR>
46      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'norm_meanstd',[NOTnormdims]: normalization of data as: (val-<val>)/stdev(val) except along <BR>
47      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dimensions [NOTnormdims] (':' list of dimension names, or 'any' for using all dimensions)<BR>
48       &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;dimensions [NOTnormdims] (':' list of dimension names)<BR>
49      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'pot': powering with [var] ([prevalues] ** [var])<BR>
50      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'potc',[modval1]: [prevalues] ** [modval1]<BR>
51      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'repl',[modval1]: replace values of [prevalues] with values from [operfile2var] except <BR>
52      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;values in second file = [modval1]<BR>
53      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'replbig',[modval1]: replace values of [prevalues] with values from [operfile2var] except <BR>
54      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;values in second file > [modval1]<BR>
55      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'repless',[modval1]: replace values of [prevalues] with values from [operfile2var] except <BR>
56      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;values in second file < [modval1]<BR>
57      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'sub': substracting [var] ([prevalues] - [var])<BR>
58      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'subc',[modval1]: remove [modval1] of [prevalues]<BR>
59      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'upthres',[modval1],[modval2]: if [prevalues] > [modval1]; prevalues = [modval2]<BR>
60      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'upthres@oper',[modval1],[oper],[modval2]: if [prevalues] > [modval1]; prevalues = [oper] (operation with [modval2])<BR>
61      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* [file]: name of the file<BR>
62      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* [var]: variable to use ('None' for the case with constant operations: 'addc', 'divc', 'inv', 'lowthres', <BR>
63      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'lowthres@oper', 'mulc', 'potc', 'subc', 'upthres', 'upthres@oper'<BR>
64      &nbsp;&nbsp;varinfo= [varname],[Lvarname],[varunits]<BR>
65      &nbsp;&nbsp;&nbsp;&nbsp;varname: name of the final variable <BR>
66      &nbsp;&nbsp;&nbsp;&nbsp;Lvarname: long name of the final variable ('!' for spaces)<BR>
67      &nbsp;&nbsp;&nbsp;&nbsp;varunits: units of the final variable ('!' for spaces)<BR>
68    </DIV>
69    <DIV CLASS="valins">
70    * Transforming temperature from Kelvin to &deg;C<BR>
71    &nbsp;&nbsp;  $ python ${pyHOME}/nc_var.py -o compute_opersvarsfiles -S 'west_east|XLONG|-1;south_north|XLAT|-1;Time|Times|3@subc,273.15|wrfout_d01_2001-11-11_00:00:00|T2' -v 'tempC,air!temperature,C'<BR>
72    * Computing the x-derivative of first order<BR>
73    &nbsp;&nbsp;  $ python ${pyHOME}/nc_var.py -o compute_opersvarsfiles -S 'lon|lon|-1;lat|lat|-1;time_counter|time_counter|-1@forwrdderiv,1,1,2|histday.nc|t2m' -v 'tasderiv,x-derivative|of|air|temperature,K' <BR>
74    * Normalizing a variable by substracting its mean and weighting by its standard-deviation<BR>
75    &nbsp;&nbsp; $ python ${pyHOME}/nc_var.py -o compute_opersvarsfiles -S 'west_east|XLONG|-1;south_north|XLAT|-1;Time|WRFtime|-1@norm_meanstd,Time|wrfout_d01_1995-01-01_00:00:00|T2' -v 'tasnorm,normalized!2m!temperature!substracting!mean!and!weighting!by!standard!deviation,K' <BR>
76    * Getting height of the frist level from surface from a WRF file<BR>
77    &nbsp;&nbsp; $ python $pyHOME/nc_var.py -o compute_opersvarsfiles -S 'west_east|XLONG|-1;south_north|XLAT|-1;bottom_top_stag|ZNW|1@addc,0|wrfout_d01_1995-01-01_00:00:00|PH%west_east|XLONG|-1;south_north|XLAT|-1;bottom_top_stag|ZNW|1@add|wrfout_d01_1995-01-01_00:00:00|PHB%contoperation@divc,9.81%west_east|XLONG|-1;south_north|XLAT|-1;Time|WRFtime|-1@sub|wrfout_d01_1995-01-01_00:00:00|HGT' -v 'height1lev,height!above!surface!of!first!level,m'
78    * Computing wind-direction from a WRF file<BR>
79    &nbsp;&nbsp; $ python $pyHOME/nc_var.py -o compute_opersvarsfiles -S 'west_east|XLONG|-1;south_north|XLAT|-1;Time|WRFtime|-1@addc,0|wrfout_d01_1995-01-01_00:00:00|V10%west_east|XLONG|-1;south_north|XLAT|-1;Time|WRFtime|-1@arctan|wrfout_d01_1995-01-01_00:00:00|U10%contoperation@mulc,57.2957795131' -v 'wsdir,2m!wind!direction,Degrees'
80    </DIV>
81  </BODY>
82</HTML>
83
Note: See TracBrowser for help on using the repository browser.