Skip to content

Commit

Permalink
Modify Constants.m to load soil init from mat file (#143)
Browse files Browse the repository at this point in the history
* Modify Constants.m to load soil init from mat file

* Fix octave-matlab incompatibility

* Update executable

* Remove netCDF octave dependency

* Add config file for snellius global data

* Remove another netcdf reference

* Update exe for main merge
  • Loading branch information
BSchilperoort authored Feb 21, 2023
1 parent 7a5cd50 commit 63fc611
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 63 deletions.
7 changes: 2 additions & 5 deletions Octave_instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@ The downloads can be found here
https://octave.org/download

TODO: installation of octave on linux
After installation, launch octave and install the following Octave packages:
`pkg install -forge netcdf`
After installation, launch octave and install the following Octave package:
`pkg install -forge statistics`

For off-line installation, first, download the packages [netcdf](https://octave.sourceforge.io/netcdf/index.html), [io](https://octave.sourceforge.io/io/index.html) and [statistics](https://octave.sourceforge.io/statistics/index.html). Then, launch octave and run:
For off-line installation, first, download the package [io](https://octave.sourceforge.io/io/index.html) and [statistics](https://octave.sourceforge.io/statistics/index.html). Then, launch octave and run:

`pkg install netcdf-1.0.16.tar.gz`
`pkg install io-2.6.4.tar.gz`
`pkg install statistics-1.4.3.tar.gz`

Expand Down Expand Up @@ -111,6 +109,5 @@ Install Octave dependencies with

```shell
octave --eval 'pkg install -forge statistics'
octave --eval 'pkg install -forge netcdf'
```
</details>
15 changes: 15 additions & 0 deletions run_model_on_snellius/config_file_snellius_global.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
WorkDir=/scratch-shared/ecoextreml/stemmus_scope/
SoilPropertyPath=/projects/0/einf2480/model_parameters/soil_property/
ForcingPath=/projects/0/einf2480/global_data/
Location=(61.8474, 24.2948)
directional=/projects/0/einf2480/model_parameters/vegetation_property/directional/
fluspect_parameters=/projects/0/einf2480/model_parameters/vegetation_property/fluspect_parameters/
leafangles=/projects/0/einf2480/model_parameters/vegetation_property/leafangles/
radiationdata=/projects/0/einf2480/model_parameters/vegetation_property/radiationdata/
soil_spectrum=/projects/0/einf2480/model_parameters/vegetation_property/soil_spectrum/
input_data=/projects/0/einf2480/model_parameters/vegetation_property/input_data.xlsx
InitialConditionPath=/projects/0/einf2480/global_data/soil_initial/
StartTime=2014-01-01T00:00
EndTime=2014-02-01T00:00
InputPath=
OutputPath=
Binary file modified run_model_on_snellius/exe/STEMMUS_SCOPE
Binary file not shown.
116 changes: 59 additions & 57 deletions src/Constants.m
Original file line number Diff line number Diff line change
Expand Up @@ -453,71 +453,73 @@
Precip_msr=Precip_msr.*(1-fmax.*exp(-0.5*0.5*Tot_Depth/100));

% load initial soil moisture and soil temperature from ERA5
Initial_path=dir(fullfile(InitialConditionPath,[sitename,'*.nc']));
load(fullfile(InputPath, "soil_init.mat"));
% The following parameters are loaded:
% Tss
% InitT0
% InitT1
% InitT2
% InitT3
% InitT4
% InitT5
% InitT6
% InitX0
% InitX1
% InitX2
% InitX3
% InitX4
% InitX5
% InitX6
% BtmX

InitND1=5; % Unit of it is cm. These variables are used to indicated the depth corresponding to the measurement.
InitND2=15;
InitND3=60;
InitND4=100;
InitND5=200;
InitND6=300;
if SWCC==0
InitT0= -1.762; %-1.75estimated soil surface temperature-1.762
InitT1= -0.662;
InitT2= 0.264;
InitT3= 0.905;
InitT4= 4.29;
InitT5= 3.657;%;
InitT6= 6.033;
BtmT=6.62; %9 8.1
InitX0= 0.088;
InitX1= 0.095; % Measured soil liquid moisture content
InitX2= 0.180; %0.169
InitX3= 0.213; %0.205
InitX4= 0.184; %0.114
InitX5= 0.0845;
InitX6= 0.078;
BtmX=0.078;%0.078 0.05; % The initial moisture content at the bottom of the column.
InitT0= -1.762; %-1.75estimated soil surface temperature-1.762
InitT1= -0.662;
InitT2= 0.264;
InitT3= 0.905;
InitT4= 4.29;
InitT5= 3.657;%;
InitT6= 6.033;
BtmT=6.62; %9 8.1
InitX0= 0.088;
InitX1= 0.095; % Measured soil liquid moisture content
InitX2= 0.180; %0.169
InitX3= 0.213; %0.205
InitX4= 0.184; %0.114
InitX5= 0.0845;
InitX6= 0.078;
BtmX=0.078;%0.078 0.05; % The initial moisture content at the bottom of the column.
else
InitT0= ncread([InitialConditionPath,Initial_path(1).name],'skt')-273.15; %-1.75estimated soil surface temperature-1.762
InitT1= ncread([InitialConditionPath,Initial_path(2).name],'stl1')-273.15;
InitT2= ncread([InitialConditionPath,Initial_path(3).name],'stl2')-273.15;
InitT3= ncread([InitialConditionPath,Initial_path(4).name],'stl3')-273.15;
InitT4= ncread([InitialConditionPath,Initial_path(5).name],'stl4')-273.15;
InitT5= ncread([InitialConditionPath,Initial_path(5).name],'stl4')-273.15;
InitT6= ncread([InitialConditionPath,Initial_path(5).name],'stl4')-273.15;
Tss = InitT0;
if InitT0 < 0 || InitT1 < 0 || InitT2 < 0 || InitT3 < 0 || InitT4 < 0 || InitT5 < 0 || InitT6 < 0
InitT0= 0;
InitT1= 0;
InitT2= 0;
InitT3= 0;
InitT4= 0;
InitT5= 0;
InitT6= 0;
Tss = InitT0;
InitT0 = 0;
InitT1 = 0;
InitT2 = 0;
InitT3 = 0;
InitT4 = 0;
InitT5 = 0;
InitT6 = 0;
Tss = InitT0;
end
if nanmean(Ta_msr)<0
BtmT = 0; %9 8.1
else
BtmT = nanmean(Ta_msr);
end
if InitX0 > SaturatedMC(1) || InitX1 > SaturatedMC(1) ||InitX2 > SaturatedMC(2) ||...
InitX3 > SaturatedMC(3) || InitX4 > SaturatedMC(4) || InitX5 > SaturatedMC(5) || InitX6 > SaturatedMC(6)
InitX0= fieldMC(1); %0.0793
InitX1= fieldMC(1); % Measured soil liquid moisture content
InitX2= fieldMC(2); %0.182
InitX3= fieldMC(3);
InitX4= fieldMC(4); %0.14335
InitX5= fieldMC(5);
InitX6= fieldMC(6);
BtmX = fieldMC(6);
end
if nanmean(Ta_msr)<0
BtmT = 0; %9 8.1
else
BtmT = nanmean(Ta_msr);
end
InitX0= ncread([InitialConditionPath,Initial_path(6).name],'swvl1'); %0.0793
InitX1= ncread([InitialConditionPath,Initial_path(6).name],'swvl1'); % Measured soil liquid moisture content
InitX2= ncread([InitialConditionPath,Initial_path(7).name],'swvl2'); %0.182
InitX3= ncread([InitialConditionPath,Initial_path(8).name],'swvl3');
InitX4= ncread([InitialConditionPath,Initial_path(9).name],'swvl4'); %0.14335
InitX5= ncread([InitialConditionPath,Initial_path(9).name],'swvl4');
InitX6= ncread([InitialConditionPath,Initial_path(9).name],'swvl4');
BtmX = ncread([InitialConditionPath,Initial_path(9).name],'swvl4');%0.05; % The initial moisture content at the bottom of the column.
if InitX0 > SaturatedMC(1) || InitX1 > SaturatedMC(1) ||InitX2 > SaturatedMC(2) ||...
InitX3 > SaturatedMC(3) || InitX4 > SaturatedMC(4) || InitX5 > SaturatedMC(5) || InitX6 > SaturatedMC(6)
InitX0= fieldMC(1); %0.0793
InitX1= fieldMC(1); % Measured soil liquid moisture content
InitX2= fieldMC(2); %0.182
InitX3= fieldMC(3);
InitX4= fieldMC(4); %0.14335
InitX5= fieldMC(5);
InitX6= fieldMC(6);
BtmX = fieldMC(6);
end
end
1 change: 0 additions & 1 deletion src/STEMMUS_SCOPE.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

% Load in required Octave packages if STEMMUS-SCOPE is being run in Octave:
if exist('OCTAVE_VERSION', 'builtin') ~= 0
pkg load netcdf
pkg load statistics
end

Expand Down

0 comments on commit 63fc611

Please sign in to comment.