Skip to content

Commit

Permalink
Add drifting snow to the _meteo.smet files created by Alpine3D when W…
Browse files Browse the repository at this point in the history
…RITE_POI_METEO == TRUE.
  • Loading branch information
nwever committed Nov 12, 2021
1 parent 1644706 commit f023b9f
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions Source/alpine3d/alpine3d/SnowpackInterface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ SnowpackInterface::SnowpackInterface(const mio::Config& io_cfg, const size_t& nb
setInitGlacierHeight();
}

//check if simple snow drift is enabled (needs to be determined before grid requirements check!)
enable_simple_snow_drift = false;
sn_cfg.getValue("SIMPLE_SNOW_DRIFT", "Alpine3D", enable_simple_snow_drift, IOUtils::nothrow);
enable_explicit_snow_drift = false;
sn_cfg.getValue("EXPLICIT_SNOW_DRIFT", "Alpine3D", enable_explicit_snow_drift, IOUtils::nothrow);

readInitalSnowCover(snow_stations,snow_stations_coord);

if (mpicontrol.master()) {
Expand All @@ -154,12 +160,6 @@ SnowpackInterface::SnowpackInterface(const mio::Config& io_cfg, const size_t& nb
std::cout << " each using Snowpack " << snowpack::getLibVersion() << "\n";
}

//check if simple snow drift is enabled (needs to be determined before grid requirements check!)
enable_simple_snow_drift = false;
sn_cfg.getValue("SIMPLE_SNOW_DRIFT", "Alpine3D", enable_simple_snow_drift, IOUtils::nothrow);
enable_explicit_snow_drift = false;
sn_cfg.getValue("EXPLICIT_SNOW_DRIFT", "Alpine3D", enable_explicit_snow_drift, IOUtils::nothrow);

//create and prepare the vector of output grids
if (grids_write) {
sn_cfg.getValue("GRIDS_PARAMETERS", "output", output_grids);
Expand Down Expand Up @@ -1085,6 +1085,7 @@ void SnowpackInterface::write_SMET_header(const mio::StationData& meta, const do

if (useCanopy) smet_out << " ISWR_can RSWR_can";
if (snow_production) smet_out << " PSUM_TECH";
if (enable_explicit_snow_drift) smet_out << " SNOWD";
smet_out << "\n[DATA]\n";

smet_out.close();
Expand Down Expand Up @@ -1132,6 +1133,9 @@ void SnowpackInterface::write_SMET(const CurrentMeteo& met, const mio::StationDa
if (snow_production) {
smet_out << std::setw(6) << std::setprecision(3) << met.psum_tech << " ";
}
if (enable_explicit_snow_drift) {
smet_out << std::setw(6) << std::setprecision(3) << met.snowdrift << " ";
}
smet_out << "\n";

smet_out.close();
Expand Down

0 comments on commit f023b9f

Please sign in to comment.