source: Readme @ 193

Last change on this file since 193 was 141, checked in by htune, 7 years ago

modif Readme pour tenir compte des modifs de tracer des simus par trace_sens_*py

File size: 8.0 KB
Line 
1                - content -
2
3Codes under src directory:
4= = = = = = = =  = = = = =
5compute_metrics_csv.sh             htune_EOF.R
6expe_setup.R                       htune_metric.R
7extract_onemetric_csv.sh           htune_netcdf2csvMetrics.R
8htune_case_setup.R                 htune_plot.R
9htune_convertDesign.R              htune_test_plot.R
10htune_convert.R                    kLHC.R
11htune_csv2Rdata.R                  param2R.sh
12htune_EmulatingMultiMetric.R       param2Rwave.sh
13
14               - Description -
15
16BEFORE STARTING: The LMDz model will be installed two levels higher in the tree.
17Make sure to be in a "subsubdirectory" before running the model setup.
18If you are in DIR1/DIR2/Hightune right now, the models will be installed in
19DIR1.
20This allows you to avoid reinstalling the model by staying in the DIR1
21directory.
22For running other models, need to have installed MUSC on your machine: http://confluence/pages/viewpage.action?pageId=248758682
23
24Main programs :
25===============
26
27bench.sh => This bench can be used with any models just run bench.sh MODEL[LMDZ AROME ARPCLIMAT] or you can specify some option [bench.sh -help]
28
29This bench runs the following steps:
30= = =  = = = = =  = = = =  = = = = =
31
32Step 1 : Parameter definition and generation of parametric ensemble
33-------------------------------------------------------------------
34   param2R.sh : define list of parameters and their range
35             create the R script  ModelParam.R
36   
37   Usage : ./param2R.sh LHCSIZE NLHC PARAM_FILE
38   Ex : ./param2R.sh 30 3 LMDZ/param_cld
39   (when using this step for a second wave needs to use param2Rwave.sh)
40   NLHC: if NLHC=1, then generate the maximinLHS of size LHCSIZE.
41
42   htune_convertDesign.R, Automatically run by param2R.sh from version 9
43   creates design for the emulator using ModelParam.R
44   outputs : Par1D_Wave1.asc containing the parameter values
45                for SCM simulations
46             Wave1.RData containing normalized parameter values for
47                the SCM
48   Calls kLHC.R and htune_convert.R
49   kLHC.R to produce the k-extended latin hyper cubes sampling
50   htune_convert.R contains the different functions to transform from normalized to non normalized and vice/versa the different values of the parameters
51
52Step 2 : serie_[MODEL].sh
53-------------------------
54   the different scripts are available in the MODEL directory
55   This is the only model-dependent script
56   Use : ./serie_LMDZ.sh $cas $NWAVE
57   TBD homogeneise in the serie_AROME.sh to be called identically
58   Run a series of the model SCM reading the parameters from Par1D_Wave1.asc
59   netcdf ouptut files should be put in
60   ./WAVE1/[cas]
61   with names SCM_1-101.nc given in Par1D_Wave1.asc
62   Also put the available LES 1D output files in WAVE1
63
64Step 3 : Compute Metrics and convert to Rdata
65---------------------------------------------
66  use compute_metrics_csv.sh (call extract_onemetric_csv.sh for both LES and SCM and compute metrics through htune_netcdf2csvMetrics.R)
67  Syntaxis: compute_metrics_csv.sh ARMCU_REF_Ay-theta_8_9 ARMCU_REF_zav-400-600-theta_9_9 ...
68  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
69!!!!! Need to change manually the number of the wave in this script file!!!!!
70  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
71  -> call extract_onemetric_csv.sh for both LES and the dir contains simulations
72       -either use cdo to compute metrics when averaging is asked
73       -either call htune_netcdf2csvMetrics.R (that call htune_metric.R) to compute other metrics ex lwp, neb metrics, Ayotte metrics)
74  -> call htune_csv2Rdata.R=> to convert to Rdata
75           Wave1_LES.Rdata : metrics computed on LES
76           Wave1_SCM.Rdata : metrics computed on SCM
77           Assume that all the files are at an hourly time frequency
78
79   Metrics already available :
80     targetvar=averaging of any variables between two different vertical levels [zav]
81     targetvar=lwp, zhneb, Ay-theta (or any integral of positive/negative (theta) differences to the 1st time
82     TBD: averaging in time  relevant for stationary cases
83     TBD: change 1st hour by initial time
84
85"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
86Available tools to draw the simulations in vertical profiles and compare them to LES:
87""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
88=> Preliminary steps (if you want to draw the envelope of the SCM runs you need to compute the avg, min and max through cdo):
89So under the WAVE/CASE/SUBCASE directory you need to run:
90    cdo ensmin SCM_1-*.nc ensmin_SCM.nc
91    cdo ensmax SCM_1-*.nc ensmax_SCM.nc
92    cdo ensavg SCM_1-*.nc ensavg_SCM.nc     
93For CNRM SCM need to before suppress the NaN values using script_modif_fillvalue.sh (then you should run the previous cdo command with new_SCM_1*nc instead of SCM_1*nc)
94For LMDZ, need to run script_LMDZ.sh that do the cdo command and change the name of the variable for it to work (time_counter should be time and presnivs should at least ends with a 'f')
95
96Then need to modify the param_CASE_SUBCASE.py:
97    -need to change the list of the files you want to draw under "listfic"
98    normaly you just need to change the directory for the default runs of your model
99    -you can also change the type/color of lines by changing the dictionnary 'dicostyl' or 'dicocoul'
100    - you can change the time at which you want to draw the vertical profile in 'dateprof'
101    this file also contains the range xmin/xmax of the variable you want to draw as a dictionnary function of the name of the variable ('vmintab' and 'vmaxtab')
102then run the python command:
103python trace_sens_LES.py nom_variable[nom_variable=theta,u,v,rneb,qv,ql,...] $CASE $SUBCASE
104=> create a figure called 'profil_'case'_'subcase'_'nom_variable'_'time'.png
105
106TBD : could be included in the script compute_metrics_csv.sh with an automatic drawing of the profile for the variables used to compute the metrics at the given time
107
108
109Step 4 : htune_EmulatingMultiMetric.R
110-------------------------------------
111    Emulator building reading Wave1_LES.Rdata and Wave1_SCM.Rdata
112    Definition and plots of NROY spaces
113
114
115Step 6: Run a second Wave:
116------------------------
117param2Rwave.sh :use the RData file generated in htune_EmulatingMultiMetric.R
118        after history matching for previous waves.
119        Usage : ./param2Rwave.sh WAVEN RDATA_FILE
120        Ex :  ./param2Rwave.sh 2 Wave2.RData
121        WAVEN should be >= 2
122or use bench.sh -wave 2 -model MODEL
123
124Functions :
125===========
126htune_case_setup.R : some cases caracteristics for plots
127htune_metric.R : metrics computation
128htune_plot.R :  plots
129
130
131Imput from Exeter :
132===================
133StanEmulateCodeR.R which requires :
134AutoLMcode.R
135CustomPredict.R
136impLayoutplot.R
137JamesDevelopment.R
138DannyDevelopment.R
139MultiWaveHM.R
140MySpeed1const.stan
141PredictSpeed1const.stan
142PredictSpeed2DWconst.stan
143MySpeed1.stan
144PredictSpeed1.stan
145PredictSpeed2DW.stan
146kLHC.R : LHS clever sampling
147
148
149Discussion / conventions :
150==========================
151I propose to use hourly averaged outputs.
152Should work for all the available cases.
153
154
155
156Installation rstudio :
157======================
158
159Here is how to install RStudio on Ubuntu 16.04
160
161sudo apt-get install r-base
162wget https://download1.rstudio.org/rstudio-xenial-1.0.153-amd64.deb
163sudo apt-get install gdebi
164sudo gdebi rstudio-xenial-1.0.153-amd64.deb
165
166then, you should be able to open RStudio by simply using the command:
167rstudio
168
169when you install the supplementary libraries for RStudio on Ubuntu, you will need to install netcdf-bin et libnetcdf-dev, otherwise
170the ncdf4 library won't install correctly
171
172You will also need to install these packages in RStudio:
173
174install.packages(c("ncdf4","rstan","tensor","Hmisc","lhs","fields","rgl","shape","mco","far","dicekriging","GenSA","mvtnorm","loo"))
175
176You might also need:
177r-cran-rgl
178libx11-dev
179libglu1-mesa-dev
180
181Nettoyage de l'outil:
182= = = = = = = = = = =
183- expe_setup.sh
184bench2waves.sh
185bench2wavesmMetric.sh
186
187=> modif de bench et htune_EmulatingMultiMetric.R pour avoir le n° de la vague, tau et cutoff en arguments optionnels : par défaut 1,0,3
188=> modif dans extract_onemetric.sh de maximiser l'erreur sur la ref? en fait ca devrait plutot etre modifié au niveau de Disc
Note: See TracBrowser for help on using the repository browser.