extract_args
NumbaMinpack requires all arguments to be passed as a single flat array. This module provides functions to pack and unpack model variables into/from such a flat array, supporting variable grid sizes and optional arrays.
This is done using a mapping of indices for each scalar variable in the packed array, as well as pointers to the start of variable-length arrays (e.g. firn temperature, lid temperature).
The intent here is to ensure that we just have one set of logic to move data from the Python structured array format into the flat array format required by NumbaMinpack, and one set of functions we can use and re-use to extract the relevant parameters from this packed array.
The indices defined below is the “canonical” mapping of model variables to positions in the packed args array. If you want to use a new variable inside the heat equation solver (or equivalently surface fluxes, since this is called inside the heat equation solver), you need to add it here.
We define functions to extract the specific parameters we need, which is determined by the needs of the specific physics functions.
Attributes
Functions
|
Extract only the variable-length firn arrays from the packed args array. |
|
Extract only the variable-length lake arrays from the packed args array. |
|
Extract only the variable-length lid arrays from the packed args array. |
|
Extract only the meteorological data from the packed args array. |
|
Extract only the scalar parameters from the packed args array. |
|
Convert the variables from the model grid into a unified flat buffer. |
Module Contents
- extract_args.HEADER_SIZE = 25
- extract_args.IDX_AIR_TEMP = 20
- extract_args.IDX_ALBEDO = 8
- extract_args.IDX_DP_TEMP = 22
- extract_args.IDX_DT = 9
- extract_args.IDX_DZ = 10
- extract_args.IDX_EXPOSED_WATER = 2
- extract_args.IDX_FIRN_DEPTH = 15
- extract_args.IDX_K_LID_SCALAR = 11
- extract_args.IDX_LAKE = 5
- extract_args.IDX_LAKE_DEPTH = 6
- extract_args.IDX_LID = 3
- extract_args.IDX_LID_DEPTH = 4
- extract_args.IDX_LW_IN = 18
- extract_args.IDX_MELT = 1
- extract_args.IDX_N_GRID = 0
- extract_args.IDX_P_AIR = 21
- extract_args.IDX_SCALARS_END = 17
- extract_args.IDX_SFRAC_LID_SCALAR = 12
- extract_args.IDX_SNOW_LID = 7
- extract_args.IDX_SW_IN = 19
- extract_args.IDX_V_LID = 13
- extract_args.IDX_V_LID_DEPTH = 14
- extract_args.IDX_V_LID_TEMP = 16
- extract_args.IDX_WIND = 23
- extract_args.PTR_FIRN_T = 27
- extract_args.PTR_LAKE_T = 26
- extract_args.PTR_LFRAC = 29
- extract_args.PTR_LID_T = 25
- extract_args.PTR_SFRAC = 28
- extract_args.PTR_SIZE = 30