Skip to content

Commit 582161f

Browse files
authored
Merge pull request #513 from uaf-arctic-eco-modeling/508-update-example-notebooks-and-scripts-to-match-docker-reorganization
Fixes #508 update example notebooks and scripts to match docker reorganization
2 parents 80641f8 + bb36dcd commit 582161f

7 files changed

+33
-33
lines changed

scripts/Docker-sensitivity-workflow.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"1. Strat the containers <br/>\n",
2121
"`$ docker compose up -d` <br/>\n",
2222
"2. Enter to the container <br/>\n",
23-
"`$ docker compose exec dvmdostem-run bash` <br/>\n",
23+
"`$ docker compose exec dvmdostem-dev bash` <br/>\n",
2424
"3. Start jupyter notebook inside the /work folder <br/>\n",
2525
"`$ jupyter notebook --ip 0.0.0.0 --no-browser --allow-root` <br/>\n",
2626
"4. Copy the url into your browser. <br/>\n",

scripts/Docker-sensitivity-workflow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# 1. Strat the containers <br/>
1414
# `$ docker compose up -d` <br/>
1515
# 2. Enter to the container <br/>
16-
# `$ docker compose exec dvmdostem-run bash` <br/>
16+
# `$ docker compose exec dvmdostem-dev bash` <br/>
1717
# 3. Start jupyter notebook inside the /work folder <br/>
1818
# `$ jupyter notebook --ip 0.0.0.0 --no-browser --allow-root` <br/>
1919
# 4. Copy the url into your browser. <br/>

scripts/Docker-tutorial.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"1. Strat the containers <br/>\n",
2424
"`$ docker compose up -d` <br/>\n",
2525
"2. Enter to the container <br/>\n",
26-
"`$ docker compose exec dvmdostem-run bash` <br/>\n",
26+
"`$ docker compose exec dvmdostem-dev bash` <br/>\n",
2727
"3. Start jupyter notebook inside the /work folder <br/>\n",
2828
"`$ jupyter notebook --ip 0.0.0.0 --no-browser --allow-root` <br/>\n",
2929
"4. Copy the url into your browser. <br/>\n",

scripts/docker-ipython-notebook-run.ipynb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"* You have the volumes setup as specified in the project's `docker-compose.yml` file and you can access the files both from your host computer and from within the docker container(s).\n",
1414
"* You have installed the Jupyter package and can run jupyter notebooks, specifically an `IPython` notebook.\n",
1515
"\n",
16-
"> Note about packages and environments: the demo here shows a mixture of running dvm-dos-tem's supporting Python scripts \"natively\" (i.e. on your host computer, not in a Docker container) and running dvm-dos-tem's supporting Python scripts inside the Docker container. For the most consistent Python environment, it is best to run everyting through (inside) the Docker containers. However sometimes the extra typing required is onerous (`docker compose exec dvmdostem-run ...`), and there is a little extra overhead involved in interacting with the containers. So if you have the appropriate packages installed on your host machine you can run some of the scripts on your host as it shown here. This takes a little care to keep the paths straight for each command, i.e. whether you are referncing the path inside the guest/container, or on your host machine.\n",
16+
"> Note about packages and environments: the demo here shows a mixture of running dvm-dos-tem's supporting Python scripts \"natively\" (i.e. on your host computer, not in a Docker container) and running dvm-dos-tem's supporting Python scripts inside the Docker container. For the most consistent Python environment, it is best to run everyting through (inside) the Docker containers. However sometimes the extra typing required is onerous (`docker compose exec dvmdostem-dev ...`), and there is a little extra overhead involved in interacting with the containers. So if you have the appropriate packages installed on your host machine you can run some of the scripts on your host as it shown here. This takes a little care to keep the paths straight for each command, i.e. whether you are referncing the path inside the guest/container, or on your host machine.\n",
1717
"\n",
1818
"> Note that while `dmvdostem`'s supporting scripts are largely written in Python, for the most part there is not an exposed Python API. Instead the scripts are generally provided with a command line interface. So much of this tutorial, while running inside an IPython notebook, could easily be run directly from your shell.\n",
1919
"\n",
@@ -70,7 +70,7 @@
7070
"outputs": [],
7171
"source": [
7272
"# Cleanup:\n",
73-
"!docker compose exec dvmdostem-run rm -r /data/workflows/testcase_0001"
73+
"!docker compose exec dvmdostem-dev rm -r /data/workflows/testcase_0001"
7474
]
7575
},
7676
{
@@ -89,7 +89,7 @@
8989
}
9090
],
9191
"source": [
92-
"!docker compose exec dvmdostem-run scripts/setup_working_directory.py \\\n",
92+
"!docker compose exec dvmdostem-dev scripts/setup_working_directory.py \\\n",
9393
"--input-data-path /data/input-catalog/cru-ts40_ar5_rcp85_ncar-ccsm4_TOOLIK_FIELD_STATION_10x10/ \\\n",
9494
"/data/workflows/testcase_0001"
9595
]
@@ -144,7 +144,7 @@
144144
}
145145
],
146146
"source": [
147-
"!docker compose exec dvmdostem-run ls /data/workflows/testcase_0001"
147+
"!docker compose exec dvmdostem-dev ls /data/workflows/testcase_0001"
148148
]
149149
},
150150
{
@@ -266,7 +266,7 @@
266266
}
267267
],
268268
"source": [
269-
"!docker compose exec dvmdostem-run runmask-util.py --reset \\\n",
269+
"!docker compose exec dvmdostem-dev runmask-util.py --reset \\\n",
270270
"--yx 0 0 \\\n",
271271
"--show \\\n",
272272
"/data/workflows/testcase_0001/run-mask.nc"
@@ -306,7 +306,7 @@
306306
}
307307
],
308308
"source": [
309-
"!docker compose exec dvmdostem-run outspec_utils.py -s /data/workflows/testcase_0001/config/output_spec.csv"
309+
"!docker compose exec dvmdostem-dev outspec_utils.py -s /data/workflows/testcase_0001/config/output_spec.csv"
310310
]
311311
},
312312
{
@@ -653,11 +653,11 @@
653653
}
654654
],
655655
"source": [
656-
"!docker compose exec dvmdostem-run outspec_utils.py \\\n",
656+
"!docker compose exec dvmdostem-dev outspec_utils.py \\\n",
657657
"/data/workflows/testcase_0001/config/output_spec.csv \\\n",
658658
"--on GPP p m\n",
659659
"\n",
660-
"!docker compose exec dvmdostem-run outspec_utils.py \\\n",
660+
"!docker compose exec dvmdostem-dev outspec_utils.py \\\n",
661661
"/data/workflows/testcase_0001/config/output_spec.csv \\\n",
662662
"--on CMTNUM y\n"
663663
]
@@ -1087,7 +1087,7 @@
10871087
}
10881088
],
10891089
"source": [
1090-
"!docker compose exec --workdir /data/workflows/testcase_0001 dvmdostem-run \\\n",
1090+
"!docker compose exec --workdir /data/workflows/testcase_0001 dvmdostem-dev \\\n",
10911091
"dvmdostem -p 50 -e 200 -s 0 -t 0 -n 0 -l err --force-cmt 4"
10921092
]
10931093
},
@@ -1117,7 +1117,7 @@
11171117
}
11181118
],
11191119
"source": [
1120-
"!docker compose exec dvmdostem-run ls /data/workflows/testcase_0001/output"
1120+
"!docker compose exec dvmdostem-dev ls /data/workflows/testcase_0001/output"
11211121
]
11221122
},
11231123
{

scripts/docker-ipython-notebook-run.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# * You have the volumes setup as specified in the project's `docker-compose.yml` file and you can access the files both from your host computer and from within the docker container(s).
1010
# * You have installed the Jupyter package and can run jupyter notebooks, specifically an `IPython` notebook.
1111
#
12-
# > Note about packages and environments: the demo here shows a mixture of running dvm-dos-tem's supporting Python scripts "natively" (i.e. on your host computer, not in a Docker container) and running dvm-dos-tem's supporting Python scripts inside the Docker container. For the most consistent Python environment, it is best to run everyting through (inside) the Docker containers. However sometimes the extra typing required is onerous (`docker compose exec dvmdostem-run ...`), and there is a little extra overhead involved in interacting with the containers. So if you have the appropriate packages installed on your host machine you can run some of the scripts on your host as it shown here. This takes a little care to keep the paths straight for each command, i.e. whether you are referncing the path inside the guest/container, or on your host machine.
12+
# > Note about packages and environments: the demo here shows a mixture of running dvm-dos-tem's supporting Python scripts "natively" (i.e. on your host computer, not in a Docker container) and running dvm-dos-tem's supporting Python scripts inside the Docker container. For the most consistent Python environment, it is best to run everyting through (inside) the Docker containers. However sometimes the extra typing required is onerous (`docker compose exec dvmdostem-dev ...`), and there is a little extra overhead involved in interacting with the containers. So if you have the appropriate packages installed on your host machine you can run some of the scripts on your host as it shown here. This takes a little care to keep the paths straight for each command, i.e. whether you are referncing the path inside the guest/container, or on your host machine.
1313
#
1414
# > Note that while `dmvdostem`'s supporting scripts are largely written in Python, for the most part there is not an exposed Python API. Instead the scripts are generally provided with a command line interface. So much of this tutorial, while running inside an IPython notebook, could easily be run directly from your shell.
1515
#
@@ -56,13 +56,13 @@
5656

5757

5858
# Cleanup:
59-
get_ipython().system('docker compose exec dvmdostem-run rm -r /data/workflows/testcase_0001')
59+
get_ipython().system('docker compose exec dvmdostem-dev rm -r /data/workflows/testcase_0001')
6060

6161

6262
# In[9]:
6363

6464

65-
get_ipython().system('docker compose exec dvmdostem-run scripts/setup_working_directory.py --input-data-path /data/input-catalog/cru-ts40_ar5_rcp85_ncar-ccsm4_TOOLIK_FIELD_STATION_10x10/ /data/workflows/testcase_0001')
65+
get_ipython().system('docker compose exec dvmdostem-dev scripts/setup_working_directory.py --input-data-path /data/input-catalog/cru-ts40_ar5_rcp85_ncar-ccsm4_TOOLIK_FIELD_STATION_10x10/ /data/workflows/testcase_0001')
6666

6767

6868
# Now note that if you investigate **from your host** (i.e. not inside the docker container) you can see the new directory you just created (in my case, I keep the workflows up two directories from my dvm-dos-tem repo; your paths might be different):
@@ -78,7 +78,7 @@
7878
# In[11]:
7979

8080

81-
get_ipython().system('docker compose exec dvmdostem-run ls /data/workflows/testcase_0001')
81+
get_ipython().system('docker compose exec dvmdostem-dev ls /data/workflows/testcase_0001')
8282

8383

8484
# ## Adjust spatial mask
@@ -87,7 +87,7 @@
8787
# In[12]:
8888

8989

90-
get_ipython().system('docker compose exec dvmdostem-run runmask-util.py --reset --yx 0 0 --show /data/workflows/testcase_0001/run-mask.nc')
90+
get_ipython().system('docker compose exec dvmdostem-dev runmask-util.py --reset --yx 0 0 --show /data/workflows/testcase_0001/run-mask.nc')
9191

9292

9393
# ## Choose output variables
@@ -97,7 +97,7 @@
9797
# In[13]:
9898

9999

100-
get_ipython().system('docker compose exec dvmdostem-run outspec_utils.py -s /data/workflows/testcase_0001/config/output_spec.csv')
100+
get_ipython().system('docker compose exec dvmdostem-dev outspec_utils.py -s /data/workflows/testcase_0001/config/output_spec.csv')
101101

102102

103103
# This is super annoying because it needs a wider screen to display this table nicely. But we can use `pandas` to display nicely in this notebook.
@@ -115,9 +115,9 @@
115115
# In[15]:
116116

117117

118-
get_ipython().system('docker compose exec dvmdostem-run outspec_utils.py /data/workflows/testcase_0001/config/output_spec.csv --on GPP p m')
118+
get_ipython().system('docker compose exec dvmdostem-dev outspec_utils.py /data/workflows/testcase_0001/config/output_spec.csv --on GPP p m')
119119

120-
get_ipython().system('docker compose exec dvmdostem-run outspec_utils.py /data/workflows/testcase_0001/config/output_spec.csv --on CMTNUM y')
120+
get_ipython().system('docker compose exec dvmdostem-dev outspec_utils.py /data/workflows/testcase_0001/config/output_spec.csv --on CMTNUM y')
121121

122122

123123
# ## Adjust other settings
@@ -152,15 +152,15 @@
152152
# In[17]:
153153

154154

155-
get_ipython().system('docker compose exec --workdir /data/workflows/testcase_0001 dvmdostem-run dvmdostem -p 50 -e 200 -s 0 -t 0 -n 0 -l err --force-cmt 4')
155+
get_ipython().system('docker compose exec --workdir /data/workflows/testcase_0001 dvmdostem-dev dvmdostem -p 50 -e 200 -s 0 -t 0 -n 0 -l err --force-cmt 4')
156156

157157

158158
# Thats it! If we look in the output directory, we expect to see one output file for the equlibrium stage, GPP:
159159

160160
# In[18]:
161161

162162

163-
get_ipython().system('docker compose exec dvmdostem-run ls /data/workflows/testcase_0001/output')
163+
get_ipython().system('docker compose exec dvmdostem-dev ls /data/workflows/testcase_0001/output')
164164

165165

166166
# In[19]:

scripts/sensitivity_analysis_demo.ipynb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,20 +84,20 @@
8484
"!rm -r {H_RUNFOLDER}\n",
8585
"\n",
8686
"# Place to work\n",
87-
"!docker compose exec dvmdostem-run setup_working_directory.py \\\n",
87+
"!docker compose exec dvmdostem-dev setup_working_directory.py \\\n",
8888
"--input-data-path \\\n",
8989
"/data/input-catalog/cru-ts40_ar5_rcp85_ncar-ccsm4_CALM_Toolik_LTER_10x10/ \\\n",
9090
"{D_RUNFOLDER}\n",
9191
"\n",
9292
"# Run mask\n",
93-
"!docker compose exec dvmdostem-run runmask-util.py \\\n",
93+
"!docker compose exec dvmdostem-dev runmask-util.py \\\n",
9494
"--reset --yx {PXy} {PXx} {D_RUNFOLDER}/run-mask.nc\n",
9595
"\n",
9696
"# Outputs\n",
97-
"!docker compose exec dvmdostem-run outspec_utils.py \\\n",
97+
"!docker compose exec dvmdostem-dev outspec_utils.py \\\n",
9898
"{D_RUNFOLDER}/config/output_spec.csv --on GPP m p\n",
9999
"\n",
100-
"!docker compose exec dvmdostem-run outspec_utils.py \\\n",
100+
"!docker compose exec dvmdostem-dev outspec_utils.py \\\n",
101101
"{D_RUNFOLDER}/config/output_spec.csv --on CMTNUM y\n",
102102
"\n",
103103
"\n",
@@ -149,7 +149,7 @@
149149
"outputs": [],
150150
"source": [
151151
"def run_model():\n",
152-
" !docker compose exec --workdir {D_RUNFOLDER} dvmdostem-run \\\n",
152+
" !docker compose exec --workdir {D_RUNFOLDER} dvmdostem-dev \\\n",
153153
" dvmdostem -p 50 -e 200 -s 0 -t 0 -n 0 -l err --force-cmt {CMTNUM}\n",
154154
"\n",
155155
"def collect_outputs():\n",

scripts/sensitivity_analysis_demo.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@
5151
get_ipython().system('rm -r {H_RUNFOLDER}')
5252

5353
# Place to work
54-
get_ipython().system('docker compose exec dvmdostem-run setup_working_directory.py --input-data-path /data/input-catalog/cru-ts40_ar5_rcp85_ncar-ccsm4_CALM_Toolik_LTER_10x10/ {D_RUNFOLDER}')
54+
get_ipython().system('docker compose exec dvmdostem-dev setup_working_directory.py --input-data-path /data/input-catalog/cru-ts40_ar5_rcp85_ncar-ccsm4_CALM_Toolik_LTER_10x10/ {D_RUNFOLDER}')
5555

5656
# Run mask
57-
get_ipython().system('docker compose exec dvmdostem-run runmask-util.py --reset --yx {PXy} {PXx} {D_RUNFOLDER}/run-mask.nc')
57+
get_ipython().system('docker compose exec dvmdostem-dev runmask-util.py --reset --yx {PXy} {PXx} {D_RUNFOLDER}/run-mask.nc')
5858

5959
# Outputs
60-
get_ipython().system('docker compose exec dvmdostem-run outspec_utils.py {D_RUNFOLDER}/config/output_spec.csv --on GPP m p')
60+
get_ipython().system('docker compose exec dvmdostem-dev outspec_utils.py {D_RUNFOLDER}/config/output_spec.csv --on GPP m p')
6161

62-
get_ipython().system('docker compose exec dvmdostem-run outspec_utils.py {D_RUNFOLDER}/config/output_spec.csv --on CMTNUM y')
62+
get_ipython().system('docker compose exec dvmdostem-dev outspec_utils.py {D_RUNFOLDER}/config/output_spec.csv --on CMTNUM y')
6363

6464

6565
# Config, enable eq outputs
@@ -102,7 +102,7 @@ def adjust_param(new_value):
102102

103103

104104
def run_model():
105-
get_ipython().system('docker compose exec --workdir {D_RUNFOLDER} dvmdostem-run dvmdostem -p 50 -e 200 -s 0 -t 0 -n 0 -l err --force-cmt {CMTNUM}')
105+
get_ipython().system('docker compose exec --workdir {D_RUNFOLDER} dvmdostem-dev dvmdostem -p 50 -e 200 -s 0 -t 0 -n 0 -l err --force-cmt {CMTNUM}')
106106

107107
def collect_outputs():
108108
# Get the model output

0 commit comments

Comments
 (0)