Skip to content
Open
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@


def generate_roughness_length_at_sites(
roughness_length: Cube, neighbour_cube: Cube
roughness_length_cube: Cube, neighbour_cube: Cube, ignore_grid_match: bool = False
) -> Cube:
"""Generate a roughness length ancillary cube at the site locations. This performs a
spot extraction of the roughness length data at the site locations and removes time
Expand All @@ -31,12 +31,16 @@ def generate_roughness_length_at_sites(
neighbour_cube:
A cube containing information about the spot data sites and
their grid point neighbours.
ignore_grid_match:
Comment thread
mo-jbeaver marked this conversation as resolved.
If True, the coordinate hash comparison between the diagnostic cube and
the neighbour cube will be ignored. This allows the version of Iris and/or
Numpy to be different from those that generated the neighbour cube.
Returns:
A cube containing the roughness length at the site locations.
"""
roughness_length_spot = SpotExtraction(neighbour_selection_method="nearest")(
neighbour_cube, roughness_length
)
roughness_length_spot = SpotExtraction(
neighbour_selection_method="nearest", ignore_grid_match=ignore_grid_match
)(neighbour_cube, roughness_length_cube)

# Update metadata to remove any time coordinates
cube_coord = [coord.name() for coord in roughness_length_spot.coords()]
Expand Down Expand Up @@ -68,8 +72,7 @@ def generate_land_area_fraction_at_sites(
Args:
land_cover_cube:
A cube containing the Corine Land cover data. The data values should be
integers representing
different land cover types.
integers representing different land cover types.
neighbour_cube:
A cube containing information about the spot data sites. We use this rather
than a site list as it contains a completed set of altitudes which have
Expand Down Expand Up @@ -151,4 +154,7 @@ def generate_land_area_fraction_at_sites(
site_frac.coord(crd).points = site.coord(crd).points.astype(crd_type)
land_fraction.append(site_frac)

return land_fraction.concatenate_cube()
land_fraction = land_fraction.concatenate_cube()
land_fraction.rename("land_area_fraction")

return land_fraction
Comment thread
mo-jbeaver marked this conversation as resolved.
Outdated