Skip to content

Module load_tif

Deprecated

Prefer the local module, which handles both NetCDF and GeoTIFF through a single interface and is actively maintained. load_tif remains functional but will not receive new features.

This IGM module is designed to load spatial 2D raster data from any .tif file present in the working directory (folder) and transform each of them into TensorFlow variables. The name of the file becomes the name of the variable. For example, the file topg.tif will yield the variable topg. At a minimum, the module is expected to import basal topography represented by the topg variable. Additionally, it can derive basal topography from ice thickness and surface topography. Other fields present in the folder will also be converted to TensorFlow variables, allowing them to be accessed in the code via state.myvar. For instance, providing the icemask variable can help define an accumulation area, which is useful for modeling individual glaciers and preventing overflow into neighboring catchments.

The module provides functionality for resampling the data using the coarsen parameter, which 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_include 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 remain ice free (icemask_invert=false) or areas that should contain glaciers with icemask_invert=true.

This module depends on rasterio.

Contributors: G. Jouvet, A. Henz (icemask add-on).

Parameters

Default configuration file (load_tif.yaml):

load_tif:
  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

Description of the parameters:

Name Description Default value Units
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 Crop the data from NetCDF file with the given minimum x bound. -1e+20 m
xmax Crop the data from NetCDF file with the given maximum x bound. 1e+20 m
ymin Crop the data from NetCDF file with the given minimum y bound. -1e+20 m
ymax Crop the data from NetCDF file with the given maximum y bound. 1e+20 m
icemask_include Generate an ice mask from the ESRI Shapefile given by icemask_shapefile. False —
icemask_shapefile ESRI Shapefile used to generate the ice mask, looked up in the data folder (core.folder_data). icemask.shp —
icemask_invert False: the shapefile polygons are areas that should remain ice free. True: they are areas that should contain glaciers. False —