ImperialCollegeLondon / virtual_ecosystem

This repository is the home for the codebase for the Virtual Ecosystem project.
https://virtual-ecosystem.readthedocs.io
BSD 3-Clause "New" or "Revised" License
9 stars 1 forks source link

remove initialisation of microclimate variables from hydrology setup #522

Closed vgro closed 1 month ago

vgro commented 2 months ago

Is your feature request related to a problem? Please describe. The hydrology model currently initialized microclimatic variables for the first update. This is not needed as the variables will be initialized by the abiotic model and this should come first. The only variable that needs initializing is the wind_speed if the abiotic_simple model is used.

Describe the solution you'd like Replace this:

        # Create subcanopy microclimate from reference height
        # TODO this needs to be removed when variable system is up and running; only
        # wind speed needs to be initialised when abiotic simple is used, see below
        # TODO currently surface layer, needs to be replaced with 2m above ground
        for var in [
            "air_temperature",
            "relative_humidity",
            "wind_speed",
            "atmospheric_pressure",
        ]:
            self.data[var] = (
                DataArray(self.data[var + "_ref"].isel(time_index=0))
                .expand_dims("layers")
                .rename(var)
                .assign_coords(
                    coords={
                        "layers": np.array([self.surface_layer_index]),
                        "layer_roles": ("layers", ["surface"]),
                        "cell_id": self.grid.cell_id,
                    },
                )
            )

with this:

        # THIS IS THE ALTERNATIVE:
        # If wind speed is not in data, which is the case if the abiotic_simple model is
        # used, create subcanopy microclimate from reference height
        # TODO currently surface layer, needs to be replaced with 2m above ground
        # if "wind_speed" not in self.data:
        #     self.data["wind_speed"] = self.layer_structure.from_template()
        #     self.data["wind_speed"][self.surface_layer_index] = self.data[
        #         "wind_speed_ref"
        #     ].isel(time_index=0)
vgro commented 1 month ago

this becomes irrelevant with #528