improver.cli.extract_from_table module#
Script to extract values from a table.
- process(*cubes, table, row_name, new_name=None)[source]#
Extract values from a table based on the provided row and column cubes.
The data from the row cube is compared to the labels of the rows in the table of which the nearest lower label is selected. The same is done for the columns using the column cube. The value corresponding to the selected row and column is then extracted from the table. This is done for every grid square.
- Parameters:
cubes (iris.cube.CubeList) – A list of iris cubes that should contain exactly two cubes: a cube from which the data determines which rows to extract and a cube from which the data determines which columns to extract.
table (dict) – A json file containing a dictionary representing a table of data with numerical row and column labels. The rows and columns should be in numerical order. The format of the dictionary should be: {column_name_1:{row_name_1:value, row_name_2:value},…}
row_name (str) – A string to identify the cube to be used for selecting rows.
new_name (str) – If provided the resulting cube will be renamed.
- Returns:
A cube containing the extracted values from the table. The metadata will match the row cube but will be renamed if new_name is provided.
- Return type: