Skip to content

Commit

Permalink
Updating README for ggcmi_ph3; including all GCMs and scenarios in ba…
Browse files Browse the repository at this point in the history
…sh files por sdate_hdate and phu.
  • Loading branch information
minoli-pik committed Apr 29, 2021
1 parent 834c00a commit 73bf0b0
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 29 deletions.
32 changes: 18 additions & 14 deletions README_ggcmi_ph3.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,42 @@
README (28.04.2021)
------
# README (28.04.2021)
--------------------
Author: Sara Minoli
Affiliation: Potsdam Institute for Climate Impact Research, Germany
Contact: sara.minoli@pik-potsdam.de

This folder includes R-coded scripts for computing sowing and harvest dates following the approaches from Waha et al. (2012) and Minoli et al. (2019).

Running the code:
## Running the code:

1) Create a configuration file: `./compute_sdate_hdate/configuration/configuration_ggcmi_ph3.R`
### Crop calendars (sdate & hdate)

1. Adjust crop parameters in `./compute_sdate_hdate/parameters/crop_parameters.csv` (default are taken from Waha 2012 & Minoli 2019)

2. Create a configuration file: `./compute_sdate_hdate/configuration/configuration_ggcmi_ph3.R`
- Define I/O paths (make sure automatically created directories are correct)
- Define crops to simulate
- Grid coordinates (by default LPJmL grid.bin is used, which is converted into a dataframe)

2) Prepare monthly climate files: `./preprocessing/ prepare_monthly_climate_isimip3b.R` and `./preprocessing/ prepare_monthly_climate_isimip3b.sh`
3. Prepare monthly climate files: `./preprocessing/ prepare_monthly_climate_isimip3b.R` and `./preprocessing/ prepare_monthly_climate_isimip3b.sh`
- Compute long-term monthly average of temperature (degC), precipitation (mm), potential evapotranspiration (mm), P/PET ratio (frac), stored in a datatable with header: lon, lat, month, tas, pr, pet, ppet
- pass arguments and submit job via bash script

3) Set up main script: `./compute_sdate_hdate/main_ggcmi_ph3.R`
4. Set up main script: `./compute_sdate_hdate/main_ggcmi_ph3.R`
- Choose if On Cluster TRUE/FALSE
- Define Working directory

4) `./compute_sdate_hdate/main_ggcmi_ph3.R`
5. `./compute_sdate_hdate/main_ggcmi_ph3.R`
- Define loops for running scenarios and crops in batch
- To run it type: `bash main_ggcmi_ph3.sh` (note: module purge might be needed beforehand, if need to open old Rdata files)

5) `./postprocessing/create_ncdf_sdate_hdate_multiyear_ggcmi_ph3.sh`
6. `./postprocessing/create_ncdf_sdate_hdate_multiyear_ggcmi_ph3.sh`

### Phenological Heat Units (PHU)

6) `./compute_phu/main_ggcmi_ph3.sh`
1. `./compute_phu/main_ggcmi_ph3.sh`

7) `./compute_phu/postprocessing/create_lpjml_sdate_hdate_phu_input.sh`
2. `./compute_phu/postprocessing/create_lpjml_sdate_hdate_phu_input.sh`

Parameters:
- Adjust crop parameters in crop_parameters.txt (default are taken from Waha 2012 & Minoli 2019)
### Accessories

Debugging:
- ./compute_sdate_hdate/src/debugging.R can help troubleshooting
1. Debugging `./compute_sdate_hdate/src/debugging.R` can help troubleshooting
6 changes: 4 additions & 2 deletions compute_phu/main_ggcmi_ph3.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/bin/bash

# Run time per job about 30 min

wd=/home/minoli/crop_calendars_gitlab/ggcmi_ph3/compute_phu

gcms=('UKESM1-0-LL')
gcms=('GFDL-ESM4' 'IPSL-CM6A-LR' 'MPI-ESM1-2-HR' 'MRI-ESM2-0') #('GFDL-ESM4' 'IPSL-CM6A-LR' 'MPI-ESM1-2-HR' 'MRI-ESM2-0' 'UKESM1-0-LL')
scens=('historical' 'ssp585' 'ssp370' 'ssp126')
crops=('wwh' 'swh' 'mai' 'ri1' 'ri2' 'soy' 'mil' 'sor' 'pea' 'sgb' 'cas' 'rap' 'sun' 'nut' 'sgc')
irrigs=('rf' 'ir')
Expand All @@ -16,7 +18,7 @@ for gc in "${!gcms[@]}";do
echo "GCM: ${gcms[gc]} --- SCENARIO: ${scens[sc]} --- CROP: ${crops[cr]}"
echo "------------------------------------------------------------------"

sbatch --qos=standby --ntasks=1 --cpus-per-task=4 -J nc_${gc}_${sc}_${cr}_${ir} -A macmit -t 01:00:00 --workdir=${wd} -o out_err/nc_${gc}_${sc}_${crops[cr]}_${ir}.out -e out_err/nc_${gc}_${sc}_${crops[cr]}_${cr}.err R -f main_ggcmi_ph3.R --args "${gcms[gc]}" "${scens[sc]}" "${crops[cr]}" "${irrigs[ir]}"
sbatch --ntasks=1 --cpus-per-task=4 -J nc_${gc}_${sc}_${crops[cr]}_${irrigs[ir]} -A macmit -t 01:00:00 --workdir=${wd} -o out_err/nc_${gc}_${sc}_${crops[cr]}_${irrigs[ir]}.out -e out_err/nc_${gc}_${sc}_${crops[cr]}_${irrigs[ir]}.err R -f main_ggcmi_ph3.R --args "${gcms[gc]}" "${scens[sc]}" "${crops[cr]}" "${irrigs[ir]}"

done
done
Expand Down
12 changes: 1 addition & 11 deletions compute_sdate_hdate/main_ggcmi_ph3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module load piam

wd=/home/minoli/crop_calendars_gitlab/ggcmi_ph3/compute_sdate_hdate

gcms=('GFDL-ESM4') #('GFDL-ESM4' 'IPSL-CM6A-LR' 'MPI-ESM1-2-HR' 'MRI-ESM2-0' 'UKESM1-0-LL')
gcms=('GFDL-ESM4' 'IPSL-CM6A-LR' 'MPI-ESM1-2-HR' 'MRI-ESM2-0' 'UKESM1-0-LL')
scens=('ssp585' 'ssp370' 'ssp126')
syears=('1961' '1971' '1981' '1991' '2001' '2011' '2021' '2031' '2041' '2051' '2061' '2071')
eyears=('1990' '2000' '2010' '2020' '2030' '2040' '2050' '2060' '2070' '2080' '2090' '2100')
Expand All @@ -27,13 +27,3 @@ done


#------

# R -f ./postprocessing/merge_winter_spring_wheat.R --args $SLURM_ARRAY_TASK_ID




# R -f ./postprocessing/mirca2000.R

# Array 1-12 or 13
# R -f ./postprocessing/create_lpjml_sdate_hdate_input.R --args $SLURM_ARRAY_TASK_ID
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/bin/bash

# Run time per each job 15 min

wd=/home/minoli/crop_calendars_gitlab/ggcmi_ph3/compute_sdate_hdate

gcms=('UKESM1-0-LL')
gcms=('GFDL-ESM4' 'IPSL-CM6A-LR' 'MPI-ESM1-2-HR' 'MRI-ESM2-0' 'UKESM1-0-LL')
scens=('historical' 'ssp585' 'ssp370' 'ssp126')
#crops=('Maize' 'Rice' 'Sorghum' 'Soybean' 'Spring_Wheat' 'Winter_Wheat')
#irrigs=('Rainfed' 'Irrigated')
Expand All @@ -20,7 +22,7 @@ for gc in "${!gcms[@]}";do
echo "GCM: ${gcms[gc]} --- SCENARIO: ${scens[sc]} --- CROP: ${crops[cr]}"
echo "------------------------------------------------------------------"

sbatch --ntasks=1 --cpus-per-task=4 -J nc_${gc}_${sc}_${cr}_${ir} -A macmit -t 03:00:00 --workdir=${wd} -o out_err/nc_${gc}_${sc}_${crops[cr]}_${ir}.out -e out_err/nc_${gc}_${sc}_${crops[cr]}_${cr}.err R -f postprocessing/create_ncdf_sdate_hdate_multiyear_ggcmi_ph3.R --args "${crops[cr]}" "${irrigs[ir]}" "${gcms[gc]}" "${scens[sc]}"
sbatch --ntasks=1 --cpus-per-task=4 -J nc_${gc}_${sc}_${cr}_${ir} -A macmit -t 00:30:00 --workdir=${wd} -o out_err/nc_${gc}_${sc}_${crops[cr]}_${ir}.out -e out_err/nc_${gc}_${sc}_${crops[cr]}_${cr}.err R -f postprocessing/create_ncdf_sdate_hdate_multiyear_ggcmi_ph3.R --args "${crops[cr]}" "${irrigs[ir]}" "${gcms[gc]}" "${scens[sc]}"

done
done
Expand Down

0 comments on commit 73bf0b0

Please sign in to comment.