Skip to content

Module local

This IGM module is designed to load spatial 2D raster data from NetCDF or Tiff files specified by the input_file parameter. The module converts all existing 2D fields (present in the NetCDF file or in the designated folder for Tiff files) into TensorFlow variables. At a minimum, the module is expected to import basal topography represented by the topg variable. Additionally, it completes the data by deriving basal topography from ice thickness and surface topography when necessary. Other fields present 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 for 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 supports 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.

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 the xarray and rioxarray Python libraries.

Contributors: B. Finley, A. Henz (icemask add-on), G. Jouvet (tif format)

Config Structure

local:
  type: netcdf
  filename: input.nc
  coarsening:
    boundary: trim
    ratio: 1
  crop:
    xmin: null
    xmax: null
    ymin: null
    ymax: null
  icemask:
    include: False
    shapefile: icemask.shp 
    invert: False

Parameters

Name Type Units Description Default Value
type str \( dimless \) Type of file to be loaded, can be netcdf or tif netcdf
filename str \( dimless \) NetCDF input data file input.nc
coarsening.boundary str \( dimless \) Method for coarsening the data from NetCDF file: skipping or cubic_spline trim
coarsening.ratio float \( dimless \) Coarsen ratio 1
crop.xmin float \( m \) X left coordinate for cropping the NetCDF data None
crop.xmax float \( m \) X right coordinate for cropping the NetCDF data None
crop.ymin float \( m \) Y bottom coordinate for cropping the NetCDF data None
crop.ymax float \( m \) Y top coordinate for cropping the NetCDF data None
icemask.include bool \( dimless \) Include ice mask in the NetCDF file False
icemask.shapefile str \( dimless \) Shapefile for ice mask icemask.shp
icemask.invert bool \( dimless \) Invert the ice mask False