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 | [prevalues]: values from the previous operations <BR> |
---|
18 | NOTE: to start with a multiple operations one can use as operation of the first variable 'addc,0'<BR> |
---|
19 | values= '%' separated list of dimension ranges and file,operation,variable to compute<BR> |
---|
20 | [dimranges1]@[operfile1var]%[dimranges2]@[operfile2var]%[...[dimrangesM]@[operfileMvar]]<BR> |
---|
21 | dimranges: ';' separated list of dimension, dimension-variable names and their ranges ('|' separated)<BR> |
---|
22 | [dim1]|[dimv1]|[range];[dim2]|[dimv2]|[range];[...|[dimN]|[dimvN]|[range]]<BR> |
---|
23 | with [range] as:<BR> |
---|
24 | -1, all the values<BR> |
---|
25 | -9, last values<BR> |
---|
26 | int, a single value<BR> |
---|
27 | [beg,end,frq], from a beginning to an end with a given frequency<BR> |
---|
28 | &nsbp;&bnsp;'WRFtime': as time variable computed from WRF 'Times' variable<BR> |
---|
29 | NOTE: use 'contoperation' to continue an operation with the result of previous <BR> |
---|
30 | operations [prevalues] without using a variable from a file<BR> |
---|
31 | operfilevar: [oper]|[file]|[var] '|' separated list of triplets of [operation], [file], [variable name to use]<BR> |
---|
32 | * [oper]: operations (being [prevalues] the values computed until the operation)<BR> |
---|
33 | 'add': adding [var] ([prevalues] + [var])<BR> |
---|
34 | 'addc',[modval1]: add [modval1] to [prevalues]<BR> |
---|
35 | 'arctan', arctangent [-p1, pi]<BR> |
---|
36 | 'centerderiv',[N],[ord],[dim]: un-scaled center [N]-derivative of order [ord] along dimension [dim] of [var]<BR> |
---|
37 | 'div': dividing by [var] ([prevalues] / [var])<BR> |
---|
38 | 'divc',[modval1]: [prevalues] divide by [modval1]<BR> |
---|
39 | 'forwrdderiv',[N],[ord],[dim]: un-scaled forward [N]-derivative of order [ord] along dimension [dim] of [var]<BR> |
---|
40 | 'ifreq_anom',[stepdimn],[stepvardimn],[istep]: computing anomalies by substracting sub-means at each<BR> |
---|
41 | step by averaging from there all values taken every [istep] along dimension [stepdim]. <BR> |
---|
42 | mean(j) = sum(matA[j+k*istep]_k=0,Nstep)/Nstep; Nstep = len(stepdimn)/istep; j=[0,istep]<BR> |
---|
43 | [stepdimn]= name of the dimension along which to sample<BR> |
---|
44 | [stepvardimn]= name of the variable-dimension with the values for [stepdimn]<BR> |
---|
45 | [istep]= frequency to sample<BR> |
---|
46 | 'ifreq_mean',[stepdimn],[stepvardimn],[istep]: computing sub-means at each step by averaging from <BR> |
---|
47 | there all values taken every [istep] along dimension [stepdim]. <BR> |
---|
48 | mean(j) = sum(matA[j+k*istep]_k=0,Nstep)/Nstep; Nstep = len(stepdimn)/istep; j=[0,istep]<BR> |
---|
49 | [stepdimn]= name of the dimension along which to sample<BR> |
---|
50 | [stepvardimn]= name of the variable-dimension with the values for [stepdimn]<BR> |
---|
51 | [istep]= frequency to sample<BR> |
---|
52 | 'ifreq_normmeanstd',[stepdimn],[stepvardimn],[istep]: nbormalizing anomalies by substracting mean(j)/dtsv(j) <BR> |
---|
53 | sub-stats at each step by averaging from there all values taken every [istep] along dimension[stepdim]. <BR> |
---|
54 | mean(j) = sum(matA[j+k*istep]_k=0,Nstep)/Nstep; std(j) = std(matA[j+k*istep]_k=0,Nstep); <BR> |
---|
55 | Nstep = len(stepdimn)/istep; j=[0,istep]<BR> |
---|
56 | [stepdimn]= name of the dimension along which to sample<BR> |
---|
57 | [stepvardimn]= name of the variable-dimension with the values for [stepdimn]<BR> |
---|
58 | [istep]= frequency to sample<BR> |
---|
59 | 'inv': inverting [prevalues] (1/[prevalues])<BR> |
---|
60 | 'lowthres',[modval1],[modval2]: if [prevalues] < [modval1]; prevalues = [modval2]<BR> |
---|
61 | 'lowthres@oper',[modval1],[oper],[modval2]: if [prevalues] < [modval1]; prevalues = [oper] (operation as [modval2])<BR> |
---|
62 | 'mul': multiplying by [var] ([prevvalues] * [var])<BR> |
---|
63 | 'mulc',[modval1]: [prevalues] multiplied by [modval1]<BR> |
---|
64 | 'norm_meanminmax',[NOTnormdims]: normalization of data as: (val-<val>)/(max(val)-min(val)) except along <BR> |
---|
65 | dimensions [NOTnormdims] (':' list of dimension names, or 'any' for using all dimensions)<BR> |
---|
66 | 'norm_minmax',[NOTnormdims]: normalization of data as: [2val-(max(val)-min(val)]/[max(val)+min(val)]<BR> |
---|
67 | except along dimensions [NOTnormdims] (':' list of dimension names, or 'any' for using all dimensions)<BR> |
---|
68 | 'norm_meanstd',[NOTnormdims]: normalization of data as: (val-<val>)/stdev(val) except along <BR> |
---|
69 | dimensions [NOTnormdims] (':' list of dimension names, or 'any' for using all dimensions)<BR> |
---|
70 | dimensions [NOTnormdims] (':' list of dimension names)<BR> |
---|
71 | 'pot': powering with [var] ([prevalues] ** [var])<BR> |
---|
72 | 'potc',[modval1]: [prevalues] ** [modval1]<BR> |
---|
73 | 'repl',[modval1]: replace values of [prevalues] with values from [operfile2var] except <BR> |
---|
74 | values in second file = [modval1]<BR> |
---|
75 | 'replbig',[modval1]: replace values of [prevalues] with values from [operfile2var] except <BR> |
---|
76 | values in second file > [modval1]<BR> |
---|
77 | 'repless',[modval1]: replace values of [prevalues] with values from [operfile2var] except <BR> |
---|
78 | values in second file < [modval1]<BR> |
---|
79 | 'sub': substracting [var] ([prevalues] - [var])<BR> |
---|
80 | 'subc',[modval1]: remove [modval1] of [prevalues]<BR> |
---|
81 | 'upthres',[modval1],[modval2]: if [prevalues] > [modval1]; prevalues = [modval2]<BR> |
---|
82 | 'upthres@oper',[modval1],[oper],[modval2]: if [prevalues] > [modval1]; prevalues = [oper] (operation with [modval2])<BR> |
---|
83 | * [file]: name of the file<BR> |
---|
84 | * [var]: variable to use ('None' for the case with constant operations: 'addc', 'divc', 'inv', 'lowthres', <BR> |
---|
85 | 'lowthres@oper', 'mulc', 'potc', 'subc', 'upthres', 'upthres@oper'<BR> |
---|
86 | varinfo= [varname],[Lvarname],[varunits]<BR> |
---|
87 | varname: name of the final variable <BR> |
---|
88 | Lvarname: long name of the final variable ('!' for spaces)<BR> |
---|
89 | varunits: units of the final variable ('!' for spaces)<BR> |
---|
90 | </DIV> |
---|
91 | <DIV CLASS="valins"> |
---|
92 | * Transforming temperature from Kelvin to °C<BR> |
---|
93 | $ 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> |
---|
94 | * Computing the x-derivative of first order<BR> |
---|
95 | $ 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> |
---|
96 | * Normalizing a variable by substracting its mean and weighting by its standard-deviation<BR> |
---|
97 | $ 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> |
---|
98 | * Getting height of the frist level from surface from a WRF file<BR> |
---|
99 | $ 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'<BR> |
---|
100 | * Computing wind-direction from a WRF file<BR> |
---|
101 | $ 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' |
---|
102 | * Computing normalized anomalyes of WRF outputs by the mean and standard deviations of the outputs at the same hour<BR> |
---|
103 | $ python nc_var.py -o compute_opersvarsfiles -S 'Time|WRFtime|-1;south_north|XLAT|-1;west_east|XLONG|-1@ifreq_normmeanstd,Time,WRFtime,8|/home/lluis/PY/wrfout_d01_1995-01-01_00:00:00|T2' -v 'tas_ifreqnormmeanstd,tas!anomaly!by!substracting!frequency!mean!at!every!8!time-steps,K' |
---|
104 | |
---|
105 | </DIV> |
---|
106 | </BODY> |
---|
107 | </HTML> |
---|
108 | |
---|