improver.generate_ancillaries.generate_miscellaneous_ancillaries module#

A module for functions that generate ancillary cubes.

generate_distance_to_ocean(epsg_projection, coastline, land, site_cube)[source]#

Generate a distance to ocean ancillary cube. The DistanceTo plugin can’t be used directly because there isn’t a GeoDataFrame for the ocean.

The DistanceTo class is used with the coastline GeoDataframe to calculate the distance of each site to the coastline. The DistanceTo class is also used to calculate the distance to land for each site. This identifies which sites are land and which are ocean. Sites in the ocean can then be set to 0m as they are in the ocean.

Parameters:
  • epsg_projection (int) – The EPSG code of the coordinate reference system on to which latitude and longitudes will be projected to calculate distances. This is a projected coordinate system in which distances are measured in metres, for example a Lambert Azimuthal Equal Areas projection across the UK, code 3035.

  • coastline (GeoDataFrame) – A GeoDataFrame containing the coastline geometry.

  • land (GeoDataFrame) – A GeoDataFrame containing the land geometry.

  • site_cube (Cube) – A cube containing the site locations. There must be latitude and longitude coordinates.

Return type:

Cube

Returns:

A cube containing the distance to ocean ancillary data.

generate_distance_to_water(distance_to_water_feature)[source]#

Generate a distance to water ancillary cube. The distance to water is the minimum of all the provided distance to water features, such as rivers, lakes, and oceans.

The first cube in distance_to_water_feature is used as a template for the output metadata with the name updated to “distance_to_water”.

Parameters:

distance_to_water_feature (CubeList) – A CubeList containing distance to water features from sites (i.e. rivers, lakes, and oceans). Each cube should have the same set of sites defined.

Return type:

Cube

Returns:

A cube containing the distance to water ancillary data.

generate_land_area_fraction_at_sites(land_cover_cube, neighbour_cube, radius=2500)[source]#

Generate a land area fraction ancillary cube at the site locations by utilising the Corine Land cover.

The Corine Land cover is available from https://doi.org/10.2909/960998c1-1870-4e82-8051-6485205ebbac. This function requires the land cover file is provided as an iris cube.

A neighbour cube is generated on the native grid of the input land cover cube. This allows us to select the cell, on what ever resolution this data is provided, that is closest to each site location. A box can then be formed about this cell of a given size and the fraction of points within the box that are classified as land can be counted. The returned value is the fraction of the total box size that is classified as land on the input land cover grid.

Parameters:
  • land_cover_cube (Cube) – A cube containing the Corine Land cover data. The data values should be integers representing different land cover types.

  • neighbour_cube (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 been extracted from orography data on the model domain. These fill in where the site source data may be missing altitude information.

  • radius (int) – The radius in metres of the box about each site location to use to calculate the land area fraction. The default value of 2500m gives a box of approximately 5km x 5km.

Return type:

Cube

Returns:

A cube containing the land area fraction at the site locations.

generate_roughness_length_at_sites(roughness_length, neighbour_cube)[source]#

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 related coordinates.

Parameters:
  • roughness_length (Cube) – A cube containing the roughness length data.

  • neighbour_cube (Cube) – A cube containing information about the spot data sites and their grid point neighbours.

Return type:

Cube

Returns:

A cube containing the roughness length at the site locations.