deflex.search_dumped_scenarios

deflex.search_dumped_scenarios(path, extension='dflx', **parameter_filter)[source]

Filter results by extension and meta data.

The function will search the $HOME folder recursively for files with the ‘.dflx’ extension. Afterwards all files will filtered by the meta data.

If there is an info table in your input data, the keys and values can be used to filter the values. For example different region sets are defined as maps with de21, de22 and de17 and different years were modelled. Futhermore some are modelled with the heating sector (heat: True) and some not (heat: False). See the example below on how to search for these scenarios.

Parameters:
  • path (str) – Start folder from where to search recursively.
  • extension (str) – Extension of the results files (default: “.dflx”)
  • **parameter_filter – Set filter always with lists e.g. map=[“de21”] or map=[“de21”, “de22”]. The values in the list have to be strings. Two filters will be connected with ‘AND’, the values within one filter with OR. The filters year=[“2014”], map=[“de21”, “de22”] will find all scenarios with: year==2014 and (map==”de21” or map==”de22”)

Examples

>>> from deflex import TEST_PATH
>>> from deflex  import fetch_test_files
>>> my_file_name = fetch_test_files("de17_heat.dflx")
>>> res = search_dumped_scenarios(path=TEST_PATH, map=["de17"])
>>> len(res)
2
>>> sorted(res)[0].split(os.sep)[-1]
'de17_heat.dflx'
>>> res = search_dumped_scenarios(path=TEST_PATH, map=["de17", "de21"])
>>> len(res)
6
>>> res = search_dumped_scenarios(
...     path=TEST_PATH, map=["de17", "de21"], heat=["True"])
>>> len(res)
3
>>> sorted(res)[0].split(os.sep)[-1]
'de17_heat.dflx'