rwgen.RainfallModel.simulate
- RainfallModel.simulate(output_types='point', output_subfolders='default', output_format='txt', catchment_metadata=None, grid_metadata=None, epsg_code=None, cell_size=None, dem=None, simulation_length=30, n_realisations=1, timestep_length=1, start_year=2000, calendar='gregorian', random_seed=None, run_simulation=True, apply_shuffling=False, weather_model=None)
Simulate stochastic time series realisation(s) of NSRP process.
- Parameters:
output_types (str or list of str) – Types of output (discretised) rainfall required. Options are
'point'
,'catchment'
and'grid'
.output_subfolders (str or dict) – Sub-folder in which to place each output type. If
'default'
thendict(point='point', catchment='catchment', grid='grid')
is used for a spatial model anddict(point='')
for a point model (i.e. output toself.output_folder
). If None then all output files are written toself.output_folder
.output_format (str) – Flag indicating output file format for point and catchment output. Current option is
txt
. Gridded output will be written in NetCDF format.catchment_metadata (geopandas.GeoDataFrame or str) – Geodataframe containing catchments for which output is required (or path to catchments shapefile). Optional.
grid_metadata (dict or str) – Specification of output grid to use for both gridded output (optional). This grid is also used to support catchment output. Dictionary keys use ascii raster header keywords, e.g.
dict(ncols=10, nrow=10, ...)
. Usexllcorner
andyllcorner
, as well as lowercase for each keyword. If None then a grid is defined to encompass catchment locations using thecell_size
argument. The path to an ascii raster file to use as a template for the grid can be given instead.epsg_code (int) – EPSG code for projected coordinate system used for domain (required if catchment or grid output is requested).
cell_size (float) – Cell size to use if grid is None but a grid is needed for gridded output and/or catchment output.
dem (xarray.DataArray or str) – Digital elevation model (DEM) [m] as data array or ascii raster file path. Optional but recommended.
simulation_length (int) – Number of years to simulate in one realisation (minimum of 1).
n_realisations (int) – Number of realisations to simulate.
timestep_length (int) – Timestep of output [hr]. Default is 1 (hour).
start_year (int) – Start year of simulation.
calendar (str) – Flag to indicate whether
gregorian
(default accounting for leap years) or365-day
calendar should be used.random_seed (int) – Seed to use in random number generation.
run_simulation (bool) – Flag for whether to run simulation. Setting to False may be used to update
self.simulation_args
to allowself.postprocess()
to be run withoutself.simulate()
having been run first (i.e. reading from existing simulation output files).apply_shuffling (bool) – Indicates whether to run model with or without shuffling following Kim and Onof (2020) method. # TODO: Provide explanation of method
weather_model (object) – Instance of WeatherModel. # TODO: Expand explanation
Notes
Though gridded output is calculated (if
output_types
includes'grid'
) it is not yet available to write (under development).All locations in
self.point_metadata
will be written as output currently. # TODO: To be changedCatchment shapefile or geodataframe assumed to have an
ID
field that can be used to identify catchments. Both point and catchment metadata are assumed to have aName
field for use as a prefix in file naming.Updates
self.simulation_args
in preparation for post-processing.