| 1 | - content - |
|---|
| 2 | |
|---|
| 3 | Codes under src directory: |
|---|
| 4 | = = = = = = = = = = = = = |
|---|
| 5 | compute_metrics_csv.sh htune_EOF.R |
|---|
| 6 | expe_setup.R htune_metric.R |
|---|
| 7 | extract_onemetric_csv.sh htune_netcdf2csvMetrics.R |
|---|
| 8 | htune_case_setup.R htune_plot.R |
|---|
| 9 | htune_convertDesign.R htune_test_plot.R |
|---|
| 10 | htune_convert.R kLHC.R |
|---|
| 11 | htune_csv2Rdata.R param2R.sh |
|---|
| 12 | htune_EmulatingMultiMetric.R param2Rwave.sh |
|---|
| 13 | |
|---|
| 14 | - Description - |
|---|
| 15 | |
|---|
| 16 | BEFORE STARTING: The LMDz model will be installed two levels higher in the tree. |
|---|
| 17 | Make sure to be in a "subsubdirectory" before running the model setup. |
|---|
| 18 | If you are in DIR1/DIR2/Hightune right now, the models will be installed in |
|---|
| 19 | DIR1. |
|---|
| 20 | This allows you to avoid reinstalling the model by staying in the DIR1 |
|---|
| 21 | directory. |
|---|
| 22 | For running other models, need to have installed MUSC on your machine: http://confluence/pages/viewpage.action?pageId=248758682 |
|---|
| 23 | |
|---|
| 24 | Main programs : |
|---|
| 25 | =============== |
|---|
| 26 | |
|---|
| 27 | bench.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 | |
|---|
| 29 | This bench runs the following steps: |
|---|
| 30 | = = = = = = = = = = = = = = = = = |
|---|
| 31 | |
|---|
| 32 | Step 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 | |
|---|
| 52 | Step 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 | |
|---|
| 64 | Step 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 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|---|
| 86 | Available 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): |
|---|
| 89 | So 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 |
|---|
| 93 | For 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) |
|---|
| 94 | For 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 | |
|---|
| 96 | Then 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') |
|---|
| 102 | then run the python command: |
|---|
| 103 | python trace_sens_LES.py nom_variable[nom_variable=theta,u,v,rneb,qv,ql,...] param_ARM.py |
|---|
| 104 | => create a figure called 'profil_'case'_'subcase'_'nom_variable'_'time'.png |
|---|
| 105 | |
|---|
| 106 | TBD : 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 | |
|---|
| 109 | Step 4 : htune_EmulatingMultiMetric.R |
|---|
| 110 | ------------------------------------- |
|---|
| 111 | Emulator building reading Wave1_LES.Rdata and Wave1_SCM.Rdata |
|---|
| 112 | Definition and plots of ROY spaces |
|---|
| 113 | |
|---|
| 114 | |
|---|
| 115 | Step 6: Run a second Wave: |
|---|
| 116 | ------------------------ |
|---|
| 117 | param2Rwave.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 |
|---|
| 122 | or use bench.sh -wave 2 -model MODEL |
|---|
| 123 | |
|---|
| 124 | Functions : |
|---|
| 125 | =========== |
|---|
| 126 | htune_case_setup.R : some cases caracteristics for plots |
|---|
| 127 | htune_metric.R : metrics computation |
|---|
| 128 | htune_plot.R : plots |
|---|
| 129 | |
|---|
| 130 | |
|---|
| 131 | Imput from Exeter : |
|---|
| 132 | =================== |
|---|
| 133 | StanEmulateCodeR.R which requires : |
|---|
| 134 | AutoLMcode.R |
|---|
| 135 | CustomPredict.R |
|---|
| 136 | impLayoutplot.R |
|---|
| 137 | JamesDevelopment.R |
|---|
| 138 | DannyDevelopment.R |
|---|
| 139 | MultiWaveHM.R |
|---|
| 140 | MySpeed1const.stan |
|---|
| 141 | PredictSpeed1const.stan |
|---|
| 142 | PredictSpeed2DWconst.stan |
|---|
| 143 | MySpeed1.stan |
|---|
| 144 | PredictSpeed1.stan |
|---|
| 145 | PredictSpeed2DW.stan |
|---|
| 146 | kLHC.R : LHS clever sampling |
|---|
| 147 | |
|---|
| 148 | |
|---|
| 149 | Discussion / conventions : |
|---|
| 150 | ========================== |
|---|
| 151 | I propose to use hourly averaged outputs. |
|---|
| 152 | Should work for all the available cases. |
|---|
| 153 | |
|---|
| 154 | |
|---|
| 155 | |
|---|
| 156 | Installation rstudio : |
|---|
| 157 | ====================== |
|---|
| 158 | |
|---|
| 159 | Here is how to install RStudio on Ubuntu 16.04 |
|---|
| 160 | |
|---|
| 161 | sudo apt-get install r-base |
|---|
| 162 | wget https://download1.rstudio.org/rstudio-xenial-1.0.153-amd64.deb |
|---|
| 163 | sudo apt-get install gdebi |
|---|
| 164 | sudo gdebi rstudio-xenial-1.0.153-amd64.deb |
|---|
| 165 | |
|---|
| 166 | then, you should be able to open RStudio by simply using the command: |
|---|
| 167 | rstudio |
|---|
| 168 | |
|---|
| 169 | when you install the supplementary libraries for RStudio on Ubuntu, you will need to install netcdf-bin et libnetcdf-dev, otherwise |
|---|
| 170 | the ncdf4 library won't install correctly |
|---|
| 171 | |
|---|
| 172 | You will also need to install these packages in RStudio: |
|---|
| 173 | |
|---|
| 174 | install.packages(c("ncdf4","rstan","tensor","Hmisc","lhs","fields","rgl","shape","mco","far","dicekriging","GenSA","mvtnorm","loo")) |
|---|
| 175 | |
|---|
| 176 | You might also need: |
|---|
| 177 | r-cran-rgl |
|---|
| 178 | libx11-dev |
|---|
| 179 | libglu1-mesa-dev |
|---|
| 180 | |
|---|
| 181 | Nettoyage de l'outil: |
|---|
| 182 | = = = = = = = = = = = |
|---|
| 183 | - expe_setup.sh |
|---|
| 184 | bench2waves.sh |
|---|
| 185 | bench2wavesmMetric.sh |
|---|
| 186 | |
|---|
| 187 | => modif de bench et htune_EmulatingMultiMetric.R pour avoir le n° de la vague en argument |
|---|
| 188 | => modif dans extract_onemetric.sh de maximiser l'erreur sur la ref? en fait ca devrait plutot etre modifié au niveau de Disc |
|---|