smash.load_dataset#
- smash.load_dataset(name)[source]#
Load dataset.
A function allowing user to load different kinds of data or pre-filled files for a first use of the
smashpackage.Hint
See the User Guide cases section for more.
- Parameters:
- namestr
The dataset name. Should be one of
‘flwdir’ : The absolute path to a 1km² France flow directions in
smashconvention.‘cance’ : Setup and mesh dictionaries used to initialize the Model object on the Cance catchment at hourly timestep.
‘lez’ : Setup and mesh dictionaries used to initialize the Model object on the Lez catchment at daily timestep.
‘france’ : Setup and mesh dictionaries used to initialize the Model object on the France at hourly timestep.
‘path/to/dataset’ : Path to an external and complete dataset.
- Returns:
- datasetstr or tuple
Depending on the dataset choosen
‘flwdir’ : Returns a file path.
‘cance’ : Returns a tuple of dictionaries (setup and mesh).
‘lez’ : Returns a tuple of dictionaries (setup and mesh).
‘france’ : Returns a tuple of dictionaries (setup and mesh).
‘path/to/dataset’ : Returns a tuple of dictionaries (setup and mesh).
Examples
Load
flwdirdataset. (the path is updated for each user).>>> flwdir = smash.load_dataset("flwdir") >>> flwdir '/home/francois/anaconda3/envs/smash-dev/lib/python3.8/site-packages/smash/dataset/France_flwdir.tif'
Load
cancedataset as a tuple of dictionaries.>>> cance = smash.load_dataset("cance") >>> cance ({'structure': 'gr-a', 'dt': 3600, ...}, {'dx': 1000.0, 'nac': 383, ...})
Or each dictionary in a different variable.
>>> setup, mesh = smash.load_dataset("cance") >>> setup {'structure': 'gr-a', 'dt': 3600, ...} >>> mesh {'dx': 1000.0, 'nac': 383, ...}
Load
lezdataset as a tuple of dictionaries.>>> lez = smash.load_dataset("lez") >>> lez ({'structure': 'gr-a', 'dt': 86400, ...}, {'dx': 1000.0, 'nac': 172, ...})
Or each dictionary in a different variable.
>>> setup, mesh = smash.load_dataset("lez") >>> setup {'structure': 'gr-a', 'dt': 86400, ...} >>> mesh {'dx': 1000.0, 'nac': 172, ...}
Load
francedataset as a tuple of dictionaries.>>> france = smash.load_dataset("france") >>> france ({'structure': 'gr-a', 'dt': 3600, ...}, {'dx': 1000.0, 'nac': 906044, ...})
Or each dictionary in a different variable.
>>> setup, mesh = smash.load_dataset("france") >>> setup {'structure': 'gr-a', 'dt': 3600, ...} >>> mesh {'dx': 1000.0, 'nac': 906044, ...}
Load
path/to/datasetas a tuple of dictionaries.>>> dataset = smash.load_dataset("path/to/dataset") >>> dataset ({'structure': 'gr-a', 'dt': 3600, ...}, {'dx': 1000.0, 'nac': 383, ...})
Or each dictionary in a different variable.
>>> setup, mesh = smash.load_dataset("path/to/dataset") >>> setup {'structure': 'gr-a', 'dt': 3600, ...} >>> mesh {'dx': 1000.0, 'nac': 383, ...}