swifco_rs.inputs module

File input functionality., like reading raster maps and tables.

swifco_rs.inputs.tif_reader(path, dst_srs=None, bounds=None, resolution=None)

Read a GeoTIFF file and optionally re-project, clip and resample it.

Note that while this was initially intended for GeoTIFF files, it uses the generic GDAL infrastructure and should work for all raster formats supported by that library, e.g. ESRI ASCII grid.

Parameters
  • path – Path to the tiff file to load

  • dst_srs – Identifier/definition of target projection

  • bounds – Clipping bounds in coordinates of the target projection

  • resolution – Output raster resolution (a single value, used for both dimensions)

Returns

Returns the re-projected and clipped map, monkey-patched with the method coord_to_cell(x, y) to transform geo-coordinates into cell coordinates as integer tuples.

swifco_rs.inputs.xyt_release(path, lat, lon, date, ref_date, ref_map, src_srs='EPSG:4326', sep=';')

Virus release from a CSV table of geo-coordinates and dates. Use with the callback release sub-model.

Parameters
  • path – Path of the CSV table file

  • lat – Latitude/Y column name

  • lon – Longitude/X column name

  • date – Date column name

  • ref_date – Reference date corresponding to model step 0

  • ref_map – Reference map for projection and geo-transform

  • src_srs – Identifier/definition of source projection. Default: WGS84

  • sep – Column separator for the CSV file

Returns

A callback releases(t) for use with the callback release sub-model, returning a list of release coordinate tuples [(x, y), …]