|
29 | 29 | "STEMMUS_SCOPE executable file is located in the **private** repository on GitHub https://github.com/EcoExtreML/STEMMUS_SCOPE. You need to clone the repository locally and specify the path to it in the cell below. Make sure you have right access to the repository. " |
30 | 30 | ] |
31 | 31 | }, |
32 | | - { |
33 | | - "cell_type": "code", |
34 | | - "execution_count": 2, |
35 | | - "metadata": {}, |
36 | | - "outputs": [], |
37 | | - "source": [ |
38 | | - "# path to executable\n", |
39 | | - "path_to_exefile = \"STEMMUS_SCOPE/exe\"" |
40 | | - ] |
41 | | - }, |
42 | 32 | { |
43 | 33 | "cell_type": "markdown", |
44 | 34 | "metadata": {}, |
|
48 | 38 | }, |
49 | 39 | { |
50 | 40 | "cell_type": "code", |
51 | | - "execution_count": 5, |
| 41 | + "execution_count": 2, |
52 | 42 | "metadata": {}, |
53 | 43 | "outputs": [], |
54 | 44 | "source": [ |
55 | 45 | "# the user must provide the correct path\n", |
56 | 46 | "# path to config file\n", |
57 | | - "path_to_config_file = \"config_file_template.txt\"\n", |
| 47 | + "path_to_config_file = \"path_to_config_file\"\n", |
58 | 48 | "# Instantiate working directories handler from PyStemmusScope\n", |
59 | 49 | "config = PyStemmusScope.read_config(path_to_config_file)" |
60 | 50 | ] |
61 | 51 | }, |
62 | 52 | { |
63 | 53 | "cell_type": "code", |
64 | | - "execution_count": 6, |
| 54 | + "execution_count": 3, |
65 | 55 | "metadata": {}, |
66 | 56 | "outputs": [ |
67 | 57 | { |
68 | 58 | "data": { |
69 | 59 | "text/plain": [ |
70 | | - "{'SoilPropertyPath': '/projects/0/einf2480/model_parameters/soil_property/',\n", |
71 | | - " 'InputPath': '/scratch-shared/ecoextreml/stemmus_scope/input/',\n", |
72 | | - " 'OutputPath': '/scratch-shared/ecoextreml/stemmus_scope/output/',\n", |
| 60 | + "{'WorkDir': '/scratch-shared/ecoextreml/stemmus_scope/',\n", |
| 61 | + " 'SoilPropertyPath': '/projects/0/einf2480/model_parameters/soil_property/',\n", |
73 | 62 | " 'ForcingPath': '/projects/0/einf2480/forcing/plumber2_data/',\n", |
74 | 63 | " 'ForcingFileName': 'FI-Hyy_1996-2014_FLUXNET2015_Met.nc',\n", |
75 | | - " 'VegetationPropertyPath': '/projects/0/einf2480/model_parameters/vegetation_property/',\n", |
| 64 | + " 'directional': '/projects/0/einf2480/model_parameters/vegetation_property/directional/',\n", |
| 65 | + " 'fluspect_parameters': '/projects/0/einf2480/model_parameters/vegetation_property/fluspect_parameters/',\n", |
| 66 | + " 'leafangles': '/projects/0/einf2480/model_parameters/vegetation_property/leafangles/',\n", |
| 67 | + " 'radiationdata': '/projects/0/einf2480/model_parameters/vegetation_property/radiationdata/',\n", |
| 68 | + " 'soil_spectrum': '/projects/0/einf2480/model_parameters/vegetation_property/soil_spectrum/',\n", |
| 69 | + " 'input_data': '/projects/0/einf2480/model_parameters/vegetation_property/input_data.xlsx',\n", |
76 | 70 | " 'InitialConditionPath': '/projects/0/einf2480/soil_initialcondition/',\n", |
77 | | - " 'DurationSize': '17520'}" |
| 71 | + " 'NumberOfTimeSteps': '17520',\n", |
| 72 | + " 'InputPath': '/scratch-shared/ecoextreml/stemmus_scope/input/FI-Hyy_2022-05-11-1705/',\n", |
| 73 | + " 'OutputPath': '/scratch-shared/ecoextreml/stemmus_scope/output/FI-Hyy_2022-05-11-1705/'}" |
78 | 74 | ] |
79 | 75 | }, |
80 | | - "execution_count": 6, |
| 76 | + "execution_count": 3, |
81 | 77 | "metadata": {}, |
82 | 78 | "output_type": "execute_result" |
83 | 79 | } |
|
88 | 84 | }, |
89 | 85 | { |
90 | 86 | "cell_type": "code", |
91 | | - "execution_count": 18, |
| 87 | + "execution_count": 4, |
92 | 88 | "metadata": {}, |
93 | 89 | "outputs": [ |
94 | 90 | { |
95 | 91 | "data": { |
96 | 92 | "text/plain": [ |
97 | | - "{'SoilPropertyPath': '/projects/0/einf2480/model_parameters/soil_property/',\n", |
98 | | - " 'InputPath': '/scratch-shared/ecoextreml/stemmus_scope/input/',\n", |
99 | | - " 'OutputPath': '/scratch-shared/ecoextreml/stemmus_scope/output/',\n", |
| 93 | + "{'WorkDir': '/scratch-shared/ecoextreml/stemmus_scope/',\n", |
| 94 | + " 'SoilPropertyPath': '/projects/0/einf2480/model_parameters/soil_property/',\n", |
100 | 95 | " 'ForcingPath': '/projects/0/einf2480/forcing/plumber2_data/',\n", |
101 | 96 | " 'ForcingFileName': 'FI-Hyy_1996-2014_FLUXNET2015_Met.nc',\n", |
102 | | - " 'VegetationPropertyPath': '/projects/0/einf2480/model_parameters/vegetation_property/',\n", |
103 | | - " 'DurationSize': '5'}" |
| 97 | + " 'directional': '/projects/0/einf2480/model_parameters/vegetation_property/directional/',\n", |
| 98 | + " 'fluspect_parameters': '/projects/0/einf2480/model_parameters/vegetation_property/fluspect_parameters/',\n", |
| 99 | + " 'leafangles': '/projects/0/einf2480/model_parameters/vegetation_property/leafangles/',\n", |
| 100 | + " 'radiationdata': '/projects/0/einf2480/model_parameters/vegetation_property/radiationdata/',\n", |
| 101 | + " 'soil_spectrum': '/projects/0/einf2480/model_parameters/vegetation_property/soil_spectrum/',\n", |
| 102 | + " 'input_data': '/projects/0/einf2480/model_parameters/vegetation_property/input_data.xlsx',\n", |
| 103 | + " 'InitialConditionPath': '/projects/0/einf2480/soil_initialcondition/',\n", |
| 104 | + " 'NumberOfTimeSteps': '5',\n", |
| 105 | + " 'InputPath': '/scratch-shared/ecoextreml/stemmus_scope/input/FI-Hyy_2022-05-11-1705/',\n", |
| 106 | + " 'OutputPath': '/scratch-shared/ecoextreml/stemmus_scope/output/FI-Hyy_2022-05-11-1705/'}" |
104 | 107 | ] |
105 | 108 | }, |
106 | | - "execution_count": 18, |
| 109 | + "execution_count": 4, |
107 | 110 | "metadata": {}, |
108 | 111 | "output_type": "execute_result" |
109 | 112 | } |
|
123 | 126 | }, |
124 | 127 | { |
125 | 128 | "cell_type": "code", |
126 | | - "execution_count": 10, |
| 129 | + "execution_count": 5, |
127 | 130 | "metadata": {}, |
128 | 131 | "outputs": [ |
129 | 132 | { |
130 | 133 | "name": "stdout", |
131 | 134 | "output_type": "stream", |
132 | 135 | "text": [ |
133 | | - "Prepare work directory /home/sarah/temp/ecoextreml/input/NL-Hor_20220519_1455 for the station: NL-Hor\n", |
134 | | - "Prepare work directory /home/sarah/temp/ecoextreml/input/ZA-Kru_20220519_1455 for the station: ZA-Kru\n" |
| 136 | + "/scratch-shared/ecoextreml/stemmus_scope/input/ZA-Kru_20220621_1334 /scratch-shared/ecoextreml/stemmus_scope/output/ZA-Kru_20220621_1334 /scratch-shared/ecoextreml/stemmus_scope/input/ZA-Kru_20220621_1334/ZA-Kru_20220621_1334_config.txt\n" |
135 | 137 | ] |
136 | 138 | } |
137 | 139 | ], |
138 | 140 | "source": [ |
139 | 141 | "# specify the forcing filenames\n", |
140 | 142 | "# forcing_filenames_list is by default none, if full_run is true, then all stations with forcing\n", |
141 | 143 | "# listed in the ForcingPath will be used.\n", |
142 | | - "forcing_filenames_list = [\"NL-Hor_2008-2011_FLUXNET2015_Met.nc\",\n", |
143 | | - " \"ZA-Kru_2000-2002_FLUXNET2015_Met.nc\"]\n", |
| 144 | + "forcing_filenames_list = [\"ZA-Kru_2000-2002_FLUXNET2015_Met.nc\"]\n", |
144 | 145 | "\n", |
145 | 146 | "full_run = False\n", |
146 | 147 | "if full_run:\n", |
|
167 | 168 | }, |
168 | 169 | { |
169 | 170 | "cell_type": "code", |
170 | | - "execution_count": 13, |
| 171 | + "execution_count": null, |
171 | 172 | "metadata": {}, |
172 | | - "outputs": [ |
173 | | - { |
174 | | - "name": "stdout", |
175 | | - "output_type": "stream", |
176 | | - "text": [ |
177 | | - "/usr/local/MATLAB/MATLAB_Runtime/v910/runtime/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v910/bin/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v910/sys/os/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v910/extern/bin/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v910/sys/opengl/lib/glnxa64\n" |
178 | | - ] |
179 | | - } |
180 | | - ], |
| 173 | + "outputs": [], |
181 | 174 | "source": [ |
182 | 175 | "# # Set LD_LIBRARY_PATH\n", |
183 | | - "matlab_path = !whereis MATLAB\n", |
184 | | - "matlab_path = matlab_path.s.split(\": \")[1]\n", |
185 | | - "os.environ['LD_LIBRARY_PATH'] = (\n", |
186 | | - " f\"{matlab_path}/MATLAB_Runtime/v910/runtime/glnxa64:\"\n", |
187 | | - " f\"{matlab_path}/MATLAB_Runtime/v910/bin/glnxa64:\"\n", |
188 | | - " f\"{matlab_path}/MATLAB_Runtime/v910/sys/os/glnxa64:\"\n", |
189 | | - " f\"{matlab_path}/MATLAB_Runtime/v910/extern/bin/glnxa64:\"\n", |
190 | | - " f\"{matlab_path}/MATLAB_Runtime/v910/sys/opengl/lib/glnxa64\")\n", |
191 | | - "print(os.environ['LD_LIBRARY_PATH'])" |
| 176 | + "# matlab_path = !whereis MATLAB\n", |
| 177 | + "# matlab_path = matlab_path.s.split(\": \")[1]\n", |
| 178 | + "# os.environ['LD_LIBRARY_PATH'] = (\n", |
| 179 | + "# f\"{matlab_path}/MATLAB_Runtime/v910/runtime/glnxa64:\"\n", |
| 180 | + "# f\"{matlab_path}/MATLAB_Runtime/v910/bin/glnxa64:\"\n", |
| 181 | + "# f\"{matlab_path}/MATLAB_Runtime/v910/sys/os/glnxa64:\"\n", |
| 182 | + "# f\"{matlab_path}/MATLAB_Runtime/v910/extern/bin/glnxa64:\"\n", |
| 183 | + "# f\"{matlab_path}/MATLAB_Runtime/v910/sys/opengl/lib/glnxa64\")\n", |
| 184 | + "# print(os.environ['LD_LIBRARY_PATH'])" |
192 | 185 | ] |
193 | 186 | }, |
194 | 187 | { |
195 | 188 | "cell_type": "code", |
196 | | - "execution_count": 14, |
| 189 | + "execution_count": 6, |
197 | 190 | "metadata": {}, |
198 | 191 | "outputs": [ |
199 | 192 | { |
200 | 193 | "name": "stdout", |
201 | 194 | "output_type": "stream", |
202 | 195 | "text": [ |
203 | | - "Run STEMMUS-SCOPE with the forcing: NL-Hor_2008-2011_FLUXNET2015_Met.nc\n", |
204 | | - "Reading config from /home/sarah/temp/ecoextreml/input/NL-Hor_20220519_1455/NL-Hor_20220519_1455_config.txt\n", |
205 | | - "\n", |
206 | | - " The calculations start now \n", |
207 | 196 | "Run STEMMUS-SCOPE with the forcing: ZA-Kru_2000-2002_FLUXNET2015_Met.nc\n", |
208 | | - "Reading config from /home/sarah/temp/ecoextreml/input/ZA-Kru_20220519_1455/ZA-Kru_20220519_1455_config.txt\n", |
| 197 | + "Opening log file: /scratch-shared/ecoextreml/stemmus_scope/input/ZA-Kru_20220621_1334/java.log.20020\n", |
| 198 | + "Reading config from /scratch-shared/ecoextreml/stemmus_scope/input/ZA-Kru_20220621_1334/ZA-Kru_20220621_1334_config.txt\n", |
209 | 199 | "\n", |
210 | 200 | " The calculations start now \n", |
211 | 201 | " The calculations end now \r" |
|
214 | 204 | ], |
215 | 205 | "source": [ |
216 | 206 | "# generate a text file\n", |
| 207 | + "path_to_model = \"path_to_STEMMUS_SCOPE_repository\"\n", |
217 | 208 | "for ncfile in forcing_filenames_list:\n", |
218 | 209 | " path_to_config = config_path_dict[ncfile]\n", |
219 | 210 | " # set matlab log dir to slurm, otherwise java.log files are created in user home dir\n", |
220 | 211 | " os.environ['MATLAB_LOG_DIR'] = str(input_dir_dict[ncfile])\n", |
221 | 212 | " # run the model\n", |
222 | 213 | " print(f\"Run STEMMUS-SCOPE with the forcing: {ncfile}\")\n", |
223 | | - " result = subprocess.run([f\"STEMMUS_SCOPE {path_to_config}\"], cwd = path_to_exefile, shell=True)\n", |
| 214 | + " result = subprocess.run([f\"exe/STEMMUS_SCOPE {path_to_config}\"], cwd = Path(path_to_model), shell=True)\n", |
224 | 215 | " result.check_returncode()" |
225 | 216 | ] |
226 | 217 | }, |
|
233 | 224 | }, |
234 | 225 | { |
235 | 226 | "cell_type": "code", |
236 | | - "execution_count": 15, |
| 227 | + "execution_count": 7, |
237 | 228 | "metadata": {}, |
238 | 229 | "outputs": [ |
239 | 230 | { |
240 | 231 | "name": "stdout", |
241 | 232 | "output_type": "stream", |
242 | 233 | "text": [ |
243 | | - "/home/sarah/temp/ecoextreml/output/NL-Hor_2022-05-19-1457/ECdata.csv\n", |
244 | | - "Reading variable metadata from /home/sarah/GitHub/STEMMUS_SCOPE/utils/csv_to_nc/Variables_will_be_in_NetCDF_file.csv\n", |
245 | | - "Creating /home/sarah/temp/ecoextreml/output/NL-Hor_2022-05-19-1457/NL-Hor_2022-05-19-1457_STEMMUS_SCOPE.nc \n", |
246 | | - "Reading data from file: radiation.csv\n", |
247 | | - "Reading data from file: fluxes.csv\n", |
248 | | - "Reading data from file: surftemp.csv\n", |
249 | | - "Reading data from file: Sim_Temp.csv\n", |
250 | | - "Reading data from file: Sim_Theta.csv\n", |
251 | | - "Reading data from file: aerodyn.csv\n", |
252 | | - "Reading data from file: ECdata.csv\n", |
253 | | - "Done writing /home/sarah/temp/ecoextreml/output/NL-Hor_2022-05-19-1457/NL-Hor_2022-05-19-1457_STEMMUS_SCOPE.nc\n", |
254 | | - "/home/sarah/temp/ecoextreml/output/ZA-Kru_2022-05-19-1458/ECdata.csv\n", |
255 | | - "Reading variable metadata from /home/sarah/GitHub/STEMMUS_SCOPE/utils/csv_to_nc/Variables_will_be_in_NetCDF_file.csv\n", |
256 | | - "Creating /home/sarah/temp/ecoextreml/output/ZA-Kru_2022-05-19-1458/ZA-Kru_2022-05-19-1458_STEMMUS_SCOPE.nc \n", |
| 234 | + "/scratch-shared/ecoextreml/stemmus_scope/output/ZA-Kru_20220621_1334/ECdata.csv\n", |
| 235 | + "Reading variable metadata from /home/yangl/STEMMUS_SCOPE/utils/csv_to_nc/Variables_will_be_in_NetCDF_file.csv\n", |
| 236 | + "Creating /scratch-shared/ecoextreml/stemmus_scope/output/ZA-Kru_20220621_1334/ZA-Kru_20220621_1334_STEMMUS_SCOPE.nc \n", |
257 | 237 | "Reading data from file: radiation.csv\n", |
258 | 238 | "Reading data from file: fluxes.csv\n", |
259 | 239 | "Reading data from file: surftemp.csv\n", |
260 | 240 | "Reading data from file: Sim_Temp.csv\n", |
261 | 241 | "Reading data from file: Sim_Theta.csv\n", |
262 | 242 | "Reading data from file: aerodyn.csv\n", |
263 | 243 | "Reading data from file: ECdata.csv\n", |
264 | | - "Done writing /home/sarah/temp/ecoextreml/output/ZA-Kru_2022-05-19-1458/ZA-Kru_2022-05-19-1458_STEMMUS_SCOPE.nc\n" |
| 244 | + "Done writing /scratch-shared/ecoextreml/stemmus_scope/output/ZA-Kru_20220621_1334/ZA-Kru_20220621_1334_STEMMUS_SCOPE.nc\n" |
265 | 245 | ] |
266 | 246 | } |
267 | 247 | ], |
268 | 248 | "source": [ |
269 | 249 | "# convert csv files to nc files\n", |
270 | | - "path_to_generate_netcdf_script = \"STEMMUS_SCOPE/utils/csv_to_nc/generate_netcdf_files.py\"\n", |
271 | | - "path_to_Variables_will_be_in_NetCDF_file = \"STEMMUS_SCOPE/utils/csv_to_nc/Variables_will_be_in_NetCDF_file.csv\"\n", |
| 250 | + "path_to_generate_netcdf_script = \"path_to_generate_netcdf_script\"\n", |
| 251 | + "path_to_Variables_will_be_in_NetCDF_file = \"path_to_Variables_will_be_in_NetCDF_file\"\n", |
272 | 252 | "for ncfile in forcing_filenames_list:\n", |
273 | 253 | " path_to_config = config_path_dict[ncfile]\n", |
274 | 254 | " result = subprocess.run([\"python\", path_to_generate_netcdf_script,\n", |
|
0 commit comments