Skip to content

Commit

Permalink
style: parquet as optional package that the user has to install
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkusPic committed Nov 12, 2024
1 parent 65eeee6 commit 4da1308
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 9 deletions.
1 change: 1 addition & 0 deletions examples/convert_old_to_new_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
idf = IntensityDurationFrequencyAnalyse(series_kind=SERIES.PARTIAL, worksheet=METHOD.KOSTRA, extended_durations=True)

# reading the pandas series of the precipitation (data from ehyd.gv.at - ID=112086)
# You need to install `pyarrow` or `fastparquet` to read and write parquet files.
# series = pd.read_parquet('ehyd_112086.parquet')['precipitation']

# setting the series for the analysis
Expand Down
1 change: 1 addition & 0 deletions examples/example_60m.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
idf = IntensityDurationFrequencyAnalyse(series_kind=SERIES.PARTIAL, worksheet=METHOD.KOSTRA, extended_durations=True)

# reading the pandas series of the precipitation (data from ehyd.gv.at - ID=112086)
# You need to install `pyarrow` or `fastparquet` to read and write parquet files.
series = pd.read_parquet('ehyd_112086.parquet')['precipitation']

series60 = series.resample('60min').sum()
Expand Down
10 changes: 6 additions & 4 deletions examples/example_heavy_rainfall_index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
}
},
"source": [
"from os import path\n",
"from pathlib import Path\n",
"\n",
"import matplotlib.pyplot as plt\n",
Expand Down Expand Up @@ -92,6 +91,11 @@
"outputs": [],
"execution_count": 3
},
{
"metadata": {},
"cell_type": "markdown",
"source": "You need to install `pyarrow` or `fastparquet` to read and write parquet files."
},
{
"cell_type": "code",
"metadata": {
Expand Down Expand Up @@ -136,9 +140,7 @@
"start_time": "2024-11-06T12:56:30.625338Z"
}
},
"source": [
"hri.auto_save_parameters(path.join(output_directory, 'idf_parameters.yaml'))"
],
"source": "hri.auto_save_parameters(output_directory / 'idf_parameters.yaml')",
"outputs": [],
"execution_count": 7
},
Expand Down
4 changes: 3 additions & 1 deletion examples/example_python_api.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"I used the rain-time-series from ehyd.gv.at with the ID 112086 (Graz-Andritz) [created with the ehyd-tools package](https://github.com/MarkusPic/ehyd_tools/blob/main/example/example_python_api.ipynb). "
"I used the rain-time-series from ehyd.gv.at with the ID 112086 (Graz-Andritz) [created with the ehyd-tools package](https://github.com/MarkusPic/ehyd_tools/blob/main/example/example_python_api.ipynb).\n",
"\n",
"You need to install `pyarrow` or `fastparquet` to read and write parquet files."
]
},
{
Expand Down
1 change: 1 addition & 0 deletions examples/example_python_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
idf = HeavyRainfallIndexAnalyse(series_kind=SERIES.PARTIAL, worksheet=METHOD.KOSTRA, extended_durations=True)

# reading the pandas series of the precipitation (data from ehyd.gv.at - ID=112086)
# You need to install `pyarrow` or `fastparquet` to read and write parquet files.
series = pd.read_parquet('ehyd_112086.parquet').squeeze()
series.name = 'precipitation'

Expand Down
1 change: 1 addition & 0 deletions examples/example_python_api_extended.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"idf = IntensityDurationFrequencyAnalyse(series_kind=SERIES.PARTIAL, worksheet=METHOD.KOSTRA, extended_durations=True)\n",
"\n",
"# reading the pandas series of the precipitation (data from ehyd.gv.at - ID=112086)\n",
"# You need to install `pyarrow` or `fastparquet` to read and write parquet files.\n",
"series = pd.read_parquet('ehyd_112086.parquet').squeeze('columns') # ['precipitation']\n",
"\n",
"# setting the series for the analysis\n",
Expand Down
1 change: 1 addition & 0 deletions examples/example_python_api_extended.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
idf = IntensityDurationFrequencyAnalyse(series_kind=SERIES.PARTIAL, worksheet=METHOD.KOSTRA, extended_durations=True)

# reading the pandas series of the precipitation (data from ehyd.gv.at - ID=112086)
# You need to install `pyarrow` or `fastparquet` to read and write parquet files.
series = pd.read_parquet('ehyd_112086.parquet')['N-Minutensummen-112086']

# setting the series for the analysis
Expand Down
1 change: 1 addition & 0 deletions idf_analysis/in_out.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def import_series(filename, series_label='precipitation', index_label='datetime'

return ts
elif filename.endswith('parquet'):
# You need to install `pyarrow` or `fastparquet` to read and write parquet files.
return pd.read_parquet(filename, columns=[series_label])[series_label].rename_axis(index_label, axis='index')
elif filename.endswith('pkl'):
return pd.read_pickle(filename).rename(series_label).rename_axis(index_label, axis='index')
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ dependencies = [
"matplotlib",
"scipy",
"PyYAML>=5",
"pyarrow",
"sympy"
]
dynamic = ["version"]
Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pandas
matplotlib
tqdm>=4.67
tqdm>=4.67 # optional
scipy
PyYAML>=5
pyarrow
sympy
sympy
# optional: You need to install `pyarrow` or `fastparquet` to read and write parquet files.

0 comments on commit 4da1308

Please sign in to comment.