Skip to content
Snippets Groups Projects
Commit 9a0d0a1b authored by Sebastian Ostberg's avatar Sebastian Ostberg
Browse files

Initial full commit

parent 59224fae
Branches master
No related tags found
No related merge requests found
# WM_LPJmL_output
# World Modelers LPJmL model for raw simulation outputs
This project contains code ingest LPJmL crop yield forecasts and historical yield simulations into the World Modelers "Dojo" system.
\ No newline at end of file
This project contains code to ingest LPJmL crop yield forecasts and historical yield simulations into the World Modelers "Dojo" system. This model returns raw, gridded simulation outputs that are not aggregated spatially or temporally.
## Historical yield simulations
`download_hist_timeseries.sh` fetches pre-computed results of the historical yield simulation from the PIK server.
## Crop yield forecasts
`download_forecast.sh` fetches pre-computed results of crop yield forecast simulations from the PIK server.
### Input knob settings
The following input knobs are available:
- fertilizer_scenario
- irrigation_scenario
- sowing_scenario
- weather_year
Input knob settings are passed as command line arguments to `download_forecast.sh`. Example call: `download_forecast.sh -fertilizer_scenario reference -irrigation_scenario reference -sowing_scenario reference -weather_year 1984-1985`
## Output
`download_hist_timeseries.sh` deposits a file `output/hist_timeseries.nc`
`download_forecast.sh` deposits a file `output/forecast_2021-2022.nc`
#!/bin/bash
# set defaults if missing command line parameters
fertilizer_scenario="reference"
sowing_scenario="reference"
irrigation_scenario="reference"
weather_year="1984-1985"
## set valid options
fertilizer_options=( "reference" "refP25" "refP50" "refP100" )
sowing_options=( "minus30" "minus15" "reference" "plus15" "plus30" )
irrigation_options=( reference )
weather_options=( "1984-1985" "1985-1986" "1986-1987" "1987-1988" "1988-1989" "1989-1990" "1990-1991" "1991-1992" "1992-1993"
"1993-1994" "1994-1995" "1995-1996" "1996-1997" "1997-1998" "1998-1999" "1999-2000" "2000-2001" "2001-2002"
"2002-2003" "2003-2004" "2004-2005" "2005-2006" "2006-2007" "2007-2008" "2008-2009" "2009-2010" "2010-2011"
"2011-2012" "2012-2013" "2013-2014" "2014-2015" "2015-2016" "2016-2017" "2017-2018" "2018-2019" "2019-2020" )
# read input parameters from command line
while(( "$#" )); do
case "$1" in
-fertilizer_scenario)
if [ $# -lt 2 ]; then
echo >&2 value for fertilizer_scenario missing
exit 1
fi
fertilizer_scenario=$2
shift 2
;;
-sowing_scenario)
if [ $# -lt 2 ]; then
echo >&2 value for sowing_scenario missing
exit 1
fi
sowing_scenario=$2
shift 2
;;
-irrigation_scenario)
if [ $# -lt 2 ]; then
echo >&2 value for irrigation_scenario missing
exit 1
fi
irrigation_scenario=$2
shift 2
;;
-weather_year)
if [ $# -lt 2 ]; then
echo >&2 value for weather_year missing
exit 1
fi
weather_year=$2
shift 2
;;
-*)
echo >&2 Invalid option $1
exit 1
;;
*)
echo >&2 Invalid argument $1
exit 1
;;
esac
done
fert_valid=0
for opt in ${fertilizer_options[@]}; do
if [ "$fertilizer_scenario" == "$opt" ]; then
fert_valid=1
fi
done
if [ ${fert_valid} -lt 1 ]; then
echo >&2 Invalid fertilizer_scenario $fertilizer_scenario
exit 1
fi
sowing_valid=0
for opt in ${sowing_options[@]}; do
if [ "$sowing_scenario" == "$opt" ]; then
sowing_valid=1
fi
done
if [ ${sowing_valid} -lt 1 ]; then
echo >&2 Invalid sowing_scenario $sowing_scenario
exit 1
fi
irrig_valid=0
for opt in ${irrigation_options[@]}; do
if [ "$irrigation_scenario" == "$opt" ]; then
irrig_valid=1
fi
done
if [ ${irrig_valid} -lt 1 ]; then
echo >&2 Invalid irrigation_scenario $irrigation_scenario
exit 1
fi
weather_valid=0
for opt in ${weather_options[@]}; do
if [ "$weather_year" == "$opt" ]; then
weather_valid=1
fi
done
if [ ${weather_valid} -lt 1 ]; then
echo >&2 Invalid weather_year $weather_year
exit 1
fi
if [ ${#sowing_scenario} -lt 5 ]; then
echo >&2 Invalid sowing_scenario $sowing_scenario
exit 1
fi
if [ "$irrigation_scenario" != "reference" ]; then
echo >&2 Invalid irrigation_scenario $irrigation_scenario
exit 1
fi
if [ ${#weather_year} -ne 9 ]; then
echo >&2 Invalid weather_year $weather_year
exit 1
fi
echo Fetching data for irrigation_scenario \"$irrigation_scenario\", fertilizer_scenario \"$fertilizer_scenario\", sowing_scenario \"$sowing_scenario\", and weather_year \"$weather_year\" from PIK server.
run=set rsync --password-file=rsync_pik c2p2_user@rsync.pik-potsdam.de::c2p2/August2021_experiment/lpjml-results/forecast_2021-2022/irrigation_target_${irrigation_scenario}_n_rate_shift_${fertilizer_scenario}_sowing_delta_${sowing_scenario}/forecast_2021-2022_wy${weather_year}.nc output/forecast_2021-2022.nc
exit $?
#!/bin/bash
echo Fetching data for historical timeseries from PIK server.
run=set rsync --password-file=rsync_pik c2p2_user@rsync.pik-potsdam.de::c2p2/August2021_experiment/lpjml-results/hist_timeseries/hist_timeseries.nc output/hist_timeseries.nc
exit $?
eveoLie1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment