Skip to content

Commit

Permalink
Allow for a 250% increase in domain expansion to search for forcing
Browse files Browse the repository at this point in the history
  • Loading branch information
Chrismarsh committed Feb 28, 2025
1 parent d8c2709 commit 30626c7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ void core::config_forcing(pt::ptree &value)
if (_interpolation_method == interp_alg::nearest_sta)
{
N = 1;
SPDLOG_DEBUG("Using N=1 nearest stations as default.");
SPDLOG_DEBUG("Setting N=1 for nearest interpolant");
}

if( (*N < 2) && (_interpolation_method != interp_alg::nearest_sta)) // Required more than 1 station if using spline or idw
Expand Down
19 changes: 10 additions & 9 deletions src/metdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,16 @@ void metdata::load_from_netcdf(const std::string& path, std::map<std::string, bo
}

// give up
if(tries > 3)
if(tries > 10)
{
CHM_THROW_EXCEPTION(forcing_error, "Tried to expanded the domain search by 250% but this was insufficient to "
"find any nearby forcing stations. This likely means that a station is too far away. If "
"using a netcdf input, it means the spatial resolution of the driving meteorology is "
"too coarse for a domain of this size.");

done = true;
}



}while(!done);
Expand Down Expand Up @@ -400,14 +408,7 @@ void metdata::load_from_netcdf(const std::string& path, std::map<std::string, bo
" regardless of the timestep the model is started from, are defined from timestep = 0 "
". Ensure it is defined then. Also, could be a bounding box issue.");
}

if( _nstations-skipped < at_least)
{
CHM_THROW_EXCEPTION(forcing_error,
"Couldn't fullfill station number requirement after 3 25% search area expansions. "
"This means that there are not enough stations within the mesh's bounding box.");
}


} catch(netCDF::exceptions::NcException& e)
{
OGRCoordinateTransformation::DestroyCT(coordTrans);
Expand Down

0 comments on commit 30626c7

Please sign in to comment.