Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ SPDX-License-Identifier: CC-BY-4.0
* Grids built from `--elmer-mesh` without a DEM now place each column at the latitude and longitude of its mesh cell center, as they already did with `--netcdf-dem-mesh`. Every column previously sat at 75 N 40 W regardless of the mesh. Results of such runs change through the solar geometry, unless the surface energy balance is taken from ICON-Land (`--couple-to-icon-land`). The `lon` written to the output now ranges from -180 to 180 degrees east instead of being 320. https://github.com/EBFMorg/EBFM/pull/193
* Grids built from `--elmer-mesh` alone (no `--netcdf-dem-mesh`) now take each column's elevation from the mesh: the mean of the z coordinates of its cell's vertices, as `reader.py` writes them from a DEM. The elevation was previously random between 0 and 100 m. A mesh without elevation data, such as `examples/greenland_mesh_v0/MESH`, now gives 0 m everywhere. https://github.com/EBFMorg/EBFM/pull/193
* Grids built from `--elmer-mesh` alone (no `--netcdf-dem-mesh`) now take each column's surface slope and orientation from the plane through the vertices of its mesh cell, instead of treating every column as flat. This changes the shortwave radiation on sloping columns. A mesh without elevation data still gives flat columns. When coupled to Elmer/Ice (`--couple-to-elmer-ice`), the columns stay flat and a warning is logged, since the slopes do not follow the surface elevation received from Elmer/Ice yet. https://github.com/EBFMorg/EBFM/pull/193
* Provide more realistic initial values for temperature and pressure. This fixes a bug if (initial) temperature and pressure are used as fallback values in a coupled run. https://github.com/EBFMorg/EBFM/pull/212

# v0.8.0

Expand Down
4 changes: 2 additions & 2 deletions src/ebfm/core/INIT.py
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ def init_initial_conditions(
######################################################
# Initialize `IN` (model input variables)
######################################################
IN["T"] = np.zeros((gpsum,)) # Air temperature (K)
IN["T"] = np.zeros((gpsum,)) + 270.0 # Air temperature (K)
IN["P"] = np.zeros((gpsum,)) # Precipitation (m w.e.)
IN["snow"] = np.zeros((gpsum,)) # Snow precipitation (m w.e.)
IN["rain"] = np.zeros((gpsum,)) # Rain precipitation (m w.e.)
Expand All @@ -798,7 +798,7 @@ def init_initial_conditions(
IN["q"] = np.zeros((gpsum,)) # Specific humidity (g kg-1)
IN["VP"] = np.zeros((gpsum,)) # Vapor pressure (Pa)
IN["Dair"] = np.zeros((gpsum,)) # Air density (kg m-3)
IN["Pres"] = np.zeros((gpsum,)) # Air pressure (Pa)
IN["Pres"] = np.zeros((gpsum,)) + 101500.0 # Air pressure (Pa)
IN["SWin"] = np.zeros((gpsum,)) # Incoming SW radiation (W m-2)
IN["LWin"] = np.zeros((gpsum,)) # Incoming LW radiation (W m-2)

Expand Down
9 changes: 7 additions & 2 deletions src/ebfm/coupling/components/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,17 @@ def _get_if_coupled(
data, err = self._coupler.get(self.name, field_name)

if err:
logger.warning(f"Get for {field_name=} returned exit code ({err=}).")
logger.info(f"Get for {field_name=} returned exit code ({err=}).")
if field_name in fallback_values:
logger.warning(
logger.info(
f"Using fallback value for '{field_name}' as no data was received for this field from {self.name}."
)
return fallback_values[field_name]

logger.warning(
f"Get for {field_name=} returned exit code ({err=}) and no fallback value has been provided. "
"This will likely lead to an error later."
)
return None

assert data is not None, f"Received data for field '{field_name}' is None. {err}"
Expand Down
8 changes: 6 additions & 2 deletions src/ebfm/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,12 @@ def _main_impl():
"rlds": IN["LWin"],
"clt": IN["C"],
"sfcwind": IN["WS"],
"huss": IN["T"] * 0.0,
"sfcpres": IN["T"] * 0.0 + 101500.0,
"huss": IN["q"],
"sfcpres": IN["Pres"],
"tas": IN["T"],
"rsds": IN["SWin"],
"pr": IN["P"],
"pr_snow": IN["snow"],
}

data_from_icon_atmo = icon_atmo.exchange(data_to_icon_atmo, fallback_values)
Expand Down
Loading