Skip to content

Commit

Permalink
remove_large_output_files
Browse files Browse the repository at this point in the history
  • Loading branch information
Mostafa Daoud committed Dec 10, 2024
1 parent 33d92a8 commit 3b04065
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 148 deletions.
47 changes: 1 addition & 46 deletions src/+io/bin_to_csv.m
Original file line number Diff line number Diff line change
Expand Up @@ -91,38 +91,9 @@ function bin_to_csv(fnames, n_col, ns, options, SoilLayer, GroundwaterSettings)
Sim_qtot_units = repelem({'cm s-1'}, length(depth));
write_output(Sim_qtot_names, Sim_qtot_units, fnames.Sim_qtot_file, n_col.Sim_qtot, ns, true);

% Comment unnecessary large size files
%{
write_output({'Bottom of canopy irradiance in the shaded fraction, and average BOC irradiance'}, {'First 2162 columns: shaded fraction. Last 2162 columns: average BOC irradiance. Unit: Wm-2 um-1'}, ...
fnames.BOC_irradiance_file, n_col.BOC_irradiance, ns, true);
%% Spectrum (added on 19 September 2008)
spectrum_hemis_optical_names = {'hemispherically integrated radiation spectrum'};
spectrum_hemis_optical_units = {'W m-2 um-1'};
write_output(spectrum_hemis_optical_names, spectrum_hemis_optical_units, fnames.spectrum_hemis_optical_file, n_col.spectrum_hemis_optical, ns, true);
spectrum_obsdir_optical_names = {'radiance spectrum in observation direction'};
spectrum_obsdir_optical_units = {'W m-2 sr-1 um-1'};
write_output(spectrum_obsdir_optical_names, spectrum_obsdir_optical_units, fnames.spectrum_obsdir_optical_file, n_col.spectrum_obsdir_optical, ns, true);
if options.calc_ebal
write_output({'thermal BlackBody emission spectrum in observation direction'}, {'W m-2 sr-1 um-1'}, ...
fnames.spectrum_obsdir_BlackBody_file, n_col.spectrum_obsdir_BlackBody, ns, true);
if options.calc_planck
write_output({'thermal emission spectrum in hemispherical direction'}, {'W m-2 sr-1 um-1'}, ...
fnames.spectrum_hemis_thermal_file, n_col.spectrum_hemis_thermal, ns, true);
write_output({'thermal emission spectrum in observation direction'}, {'W m-2 sr-1 um-1'}, ...
fnames.spectrum_obsdir_thermal_file, n_col.spectrum_obsdir_thermal, ns, true);
end
end
write_output({'irradiance'}, {'W m-2 um-1'}, ...
fnames.irradiance_spectra_file, n_col.irradiance_spectra, ns, true);
%}

write_output({'reflectance'}, {'fraction of radiation in observation direction *pi / irradiance'}, ...
fnames.reflectance_file, n_col.reflectance, ns, true);
%% input and parameter values (added June 2012)
% write_output(fnames.pars_and_input_file, true)
% write_output(fnames.pars_and_input_short_file, true)

%% Optional Output
if options.calc_vert_profiles
% write_output({'Fraction leaves in the sun, fraction of observed, fraction of observed&visible per layer'}, {'rows: simulations or time steps, columns: layer numbers'}, ...
Expand Down Expand Up @@ -161,22 +132,6 @@ function bin_to_csv(fnames, n_col, ns, options, SoilLayer, GroundwaterSettings)
write_output({'fluorescence per simulation for wavelengths of 640 to 850 nm, with 1 nm resolution, for PSII only'}, {'W m-2 um-1 sr-1'}, ...
fnames.fluorescencePSII_file, n_col.fluorescencePSII, ns, true);
end

% Comment unnecessary large size files
%{
write_output({'hemispherically integrated fluorescence per simulation for wavelengths of 640 to 850 nm, with 1 nm resolution'}, {'W m-2 um-1'}, ...
fnames.fluorescence_hemis_file, n_col.fluorescence_hemis, ns, true);
write_output({'total emitted fluorescence by all leaves for wavelengths of 640 to 850 nm, with 1 nm resolution'}, {'W m-2 um-1'}, ...
fnames.fluorescence_emitted_by_all_leaves_file, n_col.fluorescence_emitted_by_all_leaves, ns, true);
write_output({'total emitted fluorescence by all photosystems for wavelengths of 640 to 850 nm, with 1 nm resolution'}, {'W m-2 um-1'}, ...
fnames.fluorescence_emitted_by_all_photosystems_file, n_col.fluorescence_emitted_by_all_photosystems, ns, true);
write_output({'TOC fluorescence contribution from sunlit leaves for wavelengths of 640 to 850 nm, with 1 nm resolution'}, {'W m-2 um-1 sr-1'}, ...
fnames.fluorescence_sunlit_file, n_col.fluorescence_sunlit, ns, true);
write_output({'TOC fluorescence contribution from shaded leaves for wavelengths of 640 to 850 nm, with 1 nm resolution'}, {'W m-2 um-1 sr-1'}, ...
fnames.fluorescence_shaded_file, n_col.fluorescence_shaded, ns, true);
write_output({'TOC fluorescence contribution from from leaves and soil after scattering for wavelenghts of 640 to 850 nm, with 1 nm resolution'}, {'W m-2 um-1 sr-1'}, ...
fnames.fluorescence_scattered_file, n_col.fluorescence_scattered, ns, true);
%}
end

fclose('all');
Expand Down
27 changes: 0 additions & 27 deletions src/+io/create_output_files_binary.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,6 @@
fnames.Sim_qva_file = fullfile(Output_dir, 'qva.bin'); % vapour flux due to dry air pressure gradient
fnames.Sim_qtot_file = fullfile(Output_dir, 'qtot.bin'); % total flux (liquid + vapour)

% Comment unnecessary large size files
%{
fnames.BOC_irradiance_file = fullfile(Output_dir, 'BOC_irradiance.bin'); % reflectance spectrum
fnames.irradiance_spectra_file = fullfile(Output_dir, 'irradiance_spectra.bin'); % Fluorescence
fnames.spectrum_hemis_optical_file = fullfile(Output_dir, 'spectrum_hemis.bin');
fnames.spectrum_obsdir_optical_file = fullfile(Output_dir, 'spectrum_obsdir.bin');
if options.calc_ebal
fnames.spectrum_obsdir_BlackBody_file = fullfile(Output_dir, 'spectrum_obsdir_BlackBody.bin'); % spectrum observation direction
end
if options.calc_planck && options.calc_ebal
fnames.spectrum_obsdir_thermal_file = fullfile(Output_dir, 'spectrum_obsdir_thermal.bin'); % spectrum observation direction
fnames.spectrum_hemis_thermal_file = fullfile(Output_dir, 'spectrum_hemis_thermal.bin'); % spectrum hemispherically integrated
end
%}

% if ~(options.simulation==1)
fnames.pars_and_input_file = fullfile(Output_dir, 'pars_and_input.bin'); % wavelength

Expand All @@ -69,7 +52,6 @@
%
%% Optional Output
if options.calc_vert_profiles
% fnames.gap_file = fullfile(Output_dir, 'gap.bin'); % gap, comment unnecessary large size files
fnames.leaftemp_file = fullfile(Output_dir, 'leaftemp.bin'); % leaftemp
fnames.layer_H_file = fullfile(Output_dir, 'layer_H.bin'); % vertical profile
fnames.layer_LE_file = fullfile(Output_dir, 'layer_lE.bin'); % latent heat
Expand Down Expand Up @@ -98,15 +80,6 @@
fnames.fluorescencePSI_file = fullfile(Output_dir, 'fluorescencePSI.bin'); % Fluorescence
fnames.fluorescencePSII_file = fullfile(Output_dir, 'fluorescencePSII.bin'); % Fluorescence
end
% Comment unnecessary large size files
%{
fnames.fluorescence_hemis_file = fullfile(Output_dir, 'fluorescence_hemis.bin'); % Fluorescence
fnames.fluorescence_emitted_by_all_leaves_file = fullfile(Output_dir, 'fluorescence_emitted_by_all_leaves.bin');
fnames.fluorescence_emitted_by_all_photosystems_file = fullfile(Output_dir, 'fluorescence_emitted_by_all_photosystems.bin');
fnames.fluorescence_sunlit_file = fullfile(Output_dir, 'fluorescence_sunlit.bin'); % Fluorescence
fnames.fluorescence_shaded_file = fullfile(Output_dir, 'fluorescence_shaded.bin'); % Fluorescence
fnames.fluorescence_scattered_file = fullfile(Output_dir, 'fluorescence_scattered.bin'); % Fluorescence
%}
else
delete([Output_dir, 'fluorescence.bin']);
end
Expand Down
74 changes: 0 additions & 74 deletions src/+io/output_data_binary.m
Original file line number Diff line number Diff line change
Expand Up @@ -83,45 +83,6 @@
n_col.Sim_qtot = length(Sim_qtot_out);
fwrite(f.Sim_qtot_file, Sim_qtot_out, 'double');

% Comment unnecessary large size files
%{
%% Spectrum (added on 19 September 2008)
spectrum_hemis_optical_out = rad.Eout_;
n_col.spectrum_hemis_optical = length(spectrum_hemis_optical_out);
fwrite(f.spectrum_hemis_optical_file, spectrum_hemis_optical_out, 'double');
spectrum_obsdir_optical_out = [rad.Lo_'];
n_col.spectrum_obsdir_optical = length(spectrum_obsdir_optical_out);
fwrite(f.spectrum_obsdir_optical_file, spectrum_obsdir_optical_out, 'double');
if options.calc_ebal
spectrum_obsdir_BlackBody_out = [rad.LotBB_'];
n_col.spectrum_obsdir_BlackBody = length(spectrum_obsdir_BlackBody_out);
fwrite(f.spectrum_obsdir_BlackBody_file, spectrum_obsdir_BlackBody_out, 'double');
if options.calc_planck
spectrum_hemis_thermal_out = [rad.Eoutte_'];
n_col.spectrum_hemis_thermal = length(spectrum_hemis_thermal_out);
fwrite(f.spectrum_hemis_thermal_file, spectrum_hemis_thermal_out, 'double');
spectrum_obsdir_thermal_out = [rad.Lot_'];
n_col.spectrum_obsdir_thermal = length(spectrum_obsdir_thermal_out);
fwrite(f.spectrum_obsdir_thermal_file, spectrum_obsdir_thermal_out, 'double');
end
end
irradiance_spectra_out = [meteo.Rin * (rad.fEsuno + rad.fEskyo)'];
n_col.irradiance_spectra = length(irradiance_spectra_out);
fwrite(f.irradiance_spectra_file, irradiance_spectra_out, 'double');
BOC_irradiance_out = [rad.Emin_(canopy.nlayers + 1, :), rad.Emin_(canopy.nlayers + 1, :) + (rad.Esun_ * gap.Ps(canopy.nlayers + 1)')'];
n_col.BOC_irradiance = length(BOC_irradiance_out);
fwrite(f.BOC_irradiance_file, BOC_irradiance_out, 'double');
%}

reflectance = pi * rad.Lo_ ./ (rad.Esun_ + rad.Esky_);
reflectance(spectral.wlS > 3000) = NaN;
reflectance_out = [reflectance'];
Expand All @@ -143,14 +104,7 @@
end

%% Optional Output

if options.calc_vert_profiles

% gap
% gap_out = [gap.Ps gap.Po gap.Pso];
% n_col.gap = numel(gap_out(:));
% fwrite(f.gap_file, gap_out, 'double'); % comment unnecessary large size files

layer_aPAR_out = [1E6 * profiles.Pn1d' 0];
n_col.layer_aPAR = length(layer_aPAR_out);
fwrite(f.layer_aPAR_file, layer_aPAR_out, 'double');
Expand All @@ -160,7 +114,6 @@
fwrite(f.layer_aPAR_Cab_file, layer_aPAR_Cab_out, 'double');

if options.calc_ebal

% leaftemp
leaftemp_out = [profiles.Tcu1d' profiles.Tch' profiles.Tc1d'];
n_col.leaftemp = length(leaftemp_out);
Expand All @@ -185,7 +138,6 @@
layer_Rn_out = [profiles.Rn1d' fluxes.Rnstot];
n_col.layer_Rn = length(layer_Rn_out);
fwrite(f.layer_Rn_file, layer_Rn_out, 'double');

end
if options.calc_fluor
layer_fluorescence_out = [profiles.fluorescence'];
Expand All @@ -209,32 +161,6 @@
n_col.fluorescencePSII = length(fluorescencePSII_out);
fwrite(f.fluorescencePSII_file, fluorescencePSII_out, 'double');
end
% Comment unnecessary large size files
%{
fluorescence_hemis_out = [rad.Fhem_];
n_col.fluorescence_hemis = length(fluorescence_hemis_out);
fwrite(f.fluorescence_hemis_file, fluorescence_hemis_out, 'double');
fluorescence_emitted_by_all_leaves_out = [rad.Fem_];
n_col.fluorescence_emitted_by_all_leaves = length(fluorescence_emitted_by_all_leaves_out);
fwrite(f.fluorescence_emitted_by_all_leaves_file, fluorescence_emitted_by_all_leaves_out, 'double');
fluorescence_emitted_by_all_photosystems_out = [rad.Femtot];
n_col.fluorescence_emitted_by_all_photosystems = length(fluorescence_emitted_by_all_photosystems_out);
fwrite(f.fluorescence_emitted_by_all_photosystems_file, fluorescence_emitted_by_all_photosystems_out, 'double');
fluorescence_sunlit_out = [sum(rad.LoF_sunlit, 2)];
n_col.fluorescence_sunlit = length(fluorescence_sunlit_out);
fwrite(f.fluorescence_sunlit_file, fluorescence_sunlit_out, 'double');
fluorescence_shaded_out = [sum(rad.LoF_shaded, 2)];
n_col.fluorescence_shaded = length(fluorescence_shaded_out);
fwrite(f.fluorescence_shaded_file, fluorescence_shaded_out, 'double');
fluorescence_scattered_out = [sum(rad.LoF_scattered, 2) + sum(rad.LoF_soil, 2)];
n_col.fluorescence_scattered = length(fluorescence_scattered_out);
fwrite(f.fluorescence_scattered_file, fluorescence_scattered_out, 'double');
%}
end
end

Expand Down
2 changes: 1 addition & 1 deletion src/STEMMUS_SCOPE.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

% set CFG to a path if it is not defined
if exist('CFG', 'var') == 0
% CFG = '../config_file_crib.txt';
CFG = '../config_file_crib.txt';
end

% set runMode to "full" if it is not defined
Expand Down

0 comments on commit 3b04065

Please sign in to comment.