Module load_ncdf
Warning: we advise to use instead module local
This IGM module is designed to load spatial 2D raster data from a NetCDF file specified by the input_file parameter. The module converts all existing 2D fields into TensorFlow variables. At a minimum, the module is expected to import basal topography represented by the topg variable. Additionally, it completes the data, such as deriving basal topography from ice thickness and surface topography. Other fields present in the NetCDF file will also be converted to TensorFlow variables, allowing them to be accessed in the code via state.myvar. For example, providing the icemask variable can be useful in defining an accumulation area, which is beneficial for modeling individual glaciers and preventing overflow into neighboring catchments.
The module offers functions for resampling the data, where the coarsen parameter can be set to values like 2, 3, or 4 (with a default value of 1 indicating no coarsening). It also provides functionality for cropping the data by setting the crop parameter to True and specifying the desired bounds.
Additionally, by setting icemask_invert to True, an ice mask can be generated from an ESRI Shapefile specified by the icemask_shapefile parameter. This mask can identify areas that should contain glaciers or areas that should remain glacier-free, based on the icemask_include parameter.
For marine / tidewater simulations, the water_level sub-config creates a 2D state.water_level field consumed downstream by the iceflow floating energy component (and by thk calving-front schemes). Set water_level.include: True to fill the domain with a uniform value (water_level.value, in metres). If a 2D water_level variable is already present in the input NetCDF, it takes precedence and the uniform fill is skipped — letting you prescribe a spatially-varying water level (e.g. a fjord geometry). If water_level is left absent, the flotation term is disabled (the lower surface follows the bed). Note: this used to live in the thk module as default_sealevel and has moved to the input phase, so that state.water_level is available before any process module runs.
The module also supports restarting an IGM run using a NetCDF file produced from a previous IGM run. To achieve this, provide the output NetCDF file from the previous run as input to IGM. The module will seek data corresponding to the starting time defined by processes.time.start and initialize the simulation at that time.
This module depends on netCDF4.
Contributors: G. Jouvet, A. Henz (icemask add-on).
Parameters
Default configuration file (load_ncdf.yaml):
load_ncdf:
input_file: input.nc
method_coarsen: skipping
coarsen: 1
crop: False
xmin: -1.0e+20
xmax: 1.0e+20
ymin: -1.0e+20
ymax: 1.0e+20
icemask_include: False
icemask_shapefile: icemask.shp
icemask_invert: False
water_level:
include: False
value: 0.0
Description of the parameters:
| Name | Description | Default value | Units |
|---|---|---|---|
input_file
|
NetCDF input data file. | input.nc | — |
method_coarsen
|
Method for coarsening the data from NetCDF file (skipping or cubic_spline). | skipping | — |
coarsen
|
Coarsen the data from NetCDF file by a certain (integer) number (2 would be twice coarser ignore data each 2 grid points). | 1 | — |
crop
|
Crop the data from NetCDF file with given top/down/left/right bounds. | False | — |
xmin
|
X left coordinate for cropping the NetCDF data. | -1e+20 | m |
xmax
|
X right coordinate for cropping the NetCDF data. | 1e+20 | m |
ymin
|
Y bottom coordinate for cropping the NetCDF data. | -1e+20 | m |
ymax
|
Y top coordinate for cropping the NetCDF data. | 1e+20 | m |
icemask_include
|
Include ice mask in the NetCDF file. | False | — |
icemask_shapefile
|
Shapefile for ice mask. | icemask.shp | — |
icemask_invert
|
Invert the ice mask. | False | — |
water_level
| Name | Description | Default value | Units |
|---|---|---|---|
water_level.include
|
Create a uniform 2D `state.water_level` field. Only applied if `water_level` is not already present in the input NetCDF. Required by the iceflow `floating` energy component for marine / tidewater setups. | False | — |
water_level.value
|
Value (in metres) used to fill the uniform `water_level` field when `include: True`. | 0.0 | m |