Preparing the model inputs
UrbanTethysChloris.jl requires two specific input files to run the model: a configuration file and a forcing file. These files are essential for defining the model's parameters and the environmental conditions under which it operates.
The configuration file is a YAML file that contains various parameters necessary for the model's operation. The dictionary will be used to initialize the model parameters. As such, most of the contents of the YAML file comes from the Data_UEHM_site_*_LCZ3 files in the original MATLAB code.
The forcing file is a NetCDF file that provides the environmental data needed for the model. The NetCDF file is created using a mixture of the Data_UEHM_site_*_LCZ3 files and the MAT files associated with the original MATLAB code, as well as some hard-coded initialization values.
The data-raw/create_*_data.jl scripts are examples of how to create these input files from the original MATLAB data. This script is designed to generate the necessary input files in the correct format for UrbanTethysChloris.jl.
Converting the MATLAB timetable to a struct
The timetable format of the forcing inputs is unreadable by Julia. Therefore, an additional processing step is necessary to convert the timetable to a struct of vectors. The table_to_struct function below will convert the timetable.
Zurich
function struct_output = table_to_struct(x)
struct_output = struct(...
'LWRin', x.LWRin, ...
'Precipitation', x.Precipitation, ...
'Tatm', x.Tatm,...
'RelativeHumidity', x.RelativeHumidity, ...
'Windspeed', x.Windspeed, ...
'Pressure_Pa', x.Pressure_Pa, ...
'SAB1', x.SAB1, ...
'SAB2', x.SAB2, ...
'SAD1', x.SAD1, ...
'SAD2', x.SAD2 ...
);
endOther test cases
function struct_output = table_to_struct(x)
struct_output = struct(...
'LWRin', x.LWRin, ...
'Rain', x.Rain, ...
'Tatm', x.TairC,...
'RelativeHumidity', x.RH, ...
'Windspeed', x.WindSpeedms, ...
'Pressure_Pa', x.PressurePa, ...
'SAB1', x.SAB1, ...
'SAB2', x.SAB2, ...
'SAD1', x.SAD1, ...
'SAD2', x.SAD2 ...
);
end