So: you have been told to do a JULES run for your project?
Here are some standardised steps to follow that should see you right in most situations:
Here are some standardised steps to follow that should see you right in most situations:
|
First, a couple of disclaimers:
|
|
|
Next, you need to start the process of getting yourself set up to use JULES. You will definitely need an MOSRS login, and I recommend environmental researchers (whether in the UK or not) to apply for a JASMIN login too (this allows you to run JULES on the JASMIN super data cluster). Follow these links to get these:
MOSRS: https://jules.jchmr.org/getting-started
JASMIN: https://www.tobymarthews.com/jules-on-jasmin.html
MOSRS: https://jules.jchmr.org/getting-started
JASMIN: https://www.tobymarthews.com/jules-on-jasmin.html
When I was putting together the JULES website, I stated here that you need three things to run a land surface model - driving data, ancillary data and control files:
- ANCILLARY DATA: Run my script GENHSA.r with menu option to generate ancillary files (n.b. these are what I call HSANCILS rather than normal ancil files: see here). Note that my script is (a) slow (takes at least a few days) and (b) quite memory-hungry (which means you probably need to run it on an HPC rather than a laptop)
- DRIVING DATA: Then run GENHSA.r with menu option to generate driving data. My script pulls in ISIMIP3b data, which is already bias-corrected.
- Next, if you are going to have rivers simulated, download river directions from HYDRO1k, correct them and append them to the ancillary file
- CONTROL FILES: Now choose an appropriate suite. I usually use a 15 PFT configuration these days.
- Adjust the timestep_len (for RFM) until you don't get the warning about thetas being set to zero (e.g. for rivers_dx=1500km I needed timestep_len<=600s).
I am going to need a webpage about comparing to station data (inc. examples about mismatched coordinates).
Notes for me:
- I need to generate an ancil file for at least a small subgrid (if I do it for a subgrid, choose NOT to crop the output file).
- Then upload that to ~/ancils on JASMIN (if you generated this only for a subgrid, rename it to lose the "_part" in the filename, but note somewhere that this file is only for a subgrid)
- Change choice9 to 2 and make sure subgrid=FALSE
module load jasr
R
source("GENHSA.r")
- While it's generating the ddata on JASMIN, upload the scripts to my VM as well and generate the subgrid=FALSE ancil file there too.
Once I have the ancil, start generating ddata
Then while that is doing, I need to modify the ancil.
Firstly, for non-graticular coordinates I need proj_x_2d and Proj_y_2d and I can get these using the commands in proj_coords.sh on my machine (although (i) this would be very easy just to add in to GENHSA itself .... and (ii) my commands seemed to corrupt the $FILEIN when I tried them with UKV ....).
Next, if l_rivers=TRUE I need to generate the _rivvars file. Do this using the commands in STEP ONE of gen_cmds_for_cropped.r which are:
#STEP ONE: Generate the full-grid source files I need:
#Make sure we have the elevation, nextx1_HSAncil and nexty1_HSAncil variables:
export rivvarname=flowdirection
ncks -Ah -v $rivvarname $HOME/ancils/HSAncil_UK500_0.5km_OPP.nc $HOME/ancils/HSAncil_UK500_0.5km_OPP_rivvars.nc
ncks -Ah -v elevation $HOME/ancils/HSAncil_UK500_0.5km_OPP.nc $HOME/ancils/HSAncil_UK500_0.5km_OPP_rivvars.nc
ncks -Ah -v longitude_2d $HOME/ancils/HSAncil_UK500_0.5km_OPP.nc $HOME/ancils/HSAncil_UK500_0.5km_OPP_rivvars.nc
ncks -Ah -v latitude_2d $HOME/ancils/HSAncil_UK500_0.5km_OPP.nc $HOME/ancils/HSAncil_UK500_0.5km_OPP_rivvars.nc
#Run Convert_direction_to_nextxy.r to generate the nextx/nexty layers
ncks -Ah -v nextx_HSAncil $HOME/ancils/HSAncil_UK500_0.5km_OPP_supp.nc $HOME/ancils/HSAncil_UK500_0.5km_OPP_rivvars.nc
ncks -Ah -v nexty_HSAncil $HOME/ancils/HSAncil_UK500_0.5km_OPP_supp.nc $HOME/ancils/HSAncil_UK500_0.5km_OPP_rivvars.nc
#In the following, ignore any errors about "ERROR: nco_rename_att() unable to rename variable "nextx1_HSAncil" attribute "_FillValue" to "eulaVlliF_" "
ncatted -Oh -a _FillValue,$rivvarname,d,, $HOME/ancils/HSAncil_UK500_0.5km_OPP_rivvars.nc $HOME/ancils/tmp.nc
ncatted -Oh -a missing_value,$rivvarname,d,, $HOME/ancils/tmp.nc $HOME/ancils/tmp.nc
ncap2 -Oh -s 'nextx1_HSAncil=nextx_HSAncil;where($rivvarname < 0) nextx1_HSAncil=$rivvarname; elsewhere nextx1_HSAncil=nextx_HSAncil' $HOME/ancils/tmp.nc $HOME/ancils/tmp.nc
ncatted -Oh -a _FillValue,nextx1_HSAncil,o,f,-9999 $HOME/ancils/tmp.nc $HOME/ancils/tmp.nc
ncatted -Oh -a missing_value,nextx1_HSAncil,o,f,-9999 $HOME/ancils/tmp.nc $HOME/ancils/tmp.nc
ncks -Ah -v nextx1_HSAncil $HOME/ancils/tmp.nc $HOME/ancils/HSAncil_UK500_0.5km_OPP_rivvars.nc
rm $HOME/ancils/tmp.nc
ncatted -Oh -a _FillValue,$rivvarname,d,, $HOME/ancils/HSAncil_UK500_0.5km_OPP_rivvars.nc $HOME/ancils/tmp.nc
ncatted -Oh -a missing_value,$rivvarname,d,, $HOME/ancils/tmp.nc $HOME/ancils/tmp.nc
ncap2 -Oh -s 'nexty1_HSAncil=nexty_HSAncil;where($rivvarname < 0) nexty1_HSAncil=$rivvarname; elsewhere nexty1_HSAncil=nexty_HSAncil' $HOME/ancils/tmp.nc $HOME/ancils/tmp.nc
ncatted -Oh -a _FillValue,nexty1_HSAncil,o,f,-9999 $HOME/ancils/tmp.nc $HOME/ancils/tmp.nc
ncatted -Oh -a missing_value,nexty1_HSAncil,o,f,-9999 $HOME/ancils/tmp.nc $HOME/ancils/tmp.nc
ncks -Ah -v nexty1_HSAncil $HOME/ancils/tmp.nc $HOME/ancils/HSAncil_UK500_0.5km_OPP_rivvars.nc
rm $HOME/ancils/tmp.nc
For CMF routing I would want to finish the steps there, but without that stop here.