Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MNT: do not use wetterdienst, revert to plain html download, use bearer token #93

Merged
merged 5 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.11"]
python-version: ["3.12"]
steps:
- uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -57,6 +57,8 @@ jobs:
python -c "import wradlib; print(wradlib.version.version)"
python -c "import wradlib; print(wradlib.show_versions())"
- name: Render with pytest
env:
WRADLIB_EARTHDATA_BEARER_TOKEN: ${{ secrets.WRADLIB_EARTHDATA_BEARER_TOKEN }}
run: |
export WRADLIB_DATA=`realpath $WRADLIB_DATA`
pytest -n auto --verbose --durations=15 --pyargs notebooks
Expand Down Expand Up @@ -90,7 +92,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.11"]
python-version: ["3.12"]
steps:
- uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -119,9 +121,12 @@ jobs:
python -c "import wradlib; print(wradlib.version.version)"
python -c "import wradlib; print(wradlib.show_versions())"
- name: Render with pytest
env:
WRADLIB_EARTHDATA_BEARER_TOKEN: ${{ secrets.WRADLIB_EARTHDATA_BEARER_TOKEN }}
run: |
export WRADLIB_DATA=`python -c "import os, sys; print(os.path.realpath(sys.argv[1]))" $WRADLIB_DATA`
pytest -n auto --verbose --durations=15 --pyargs notebooks

build_2:
name: wradlib notebooks - windows
runs-on: windows-latest
Expand All @@ -134,7 +139,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.11"]
python-version: ["3.12"]
steps:
- uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -162,6 +167,8 @@ jobs:
python -c "import wradlib; print(wradlib.version.version)"
python -c "import wradlib; print(wradlib.show_versions())"
- name: Test with pytest
env:
WRADLIB_EARTHDATA_BEARER_TOKEN: ${{ secrets.WRADLIB_EARTHDATA_BEARER_TOKEN }}
run: |
export WRADLIB_DATA=`python -c "import os, sys; print(os.path.realpath(sys.argv[1]))" $WRADLIB_DATA`
pytest -n auto --verbose --durations=15 --pyargs notebooks
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/render.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.11"]
python-version: ["3.12"]
steps:
- uses: actions/checkout@v3
with:
Expand Down
1 change: 0 additions & 1 deletion ci/requirements/notebooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ dependencies:
- semver
- setuptools
- tqdm
- wetterdienst
- xarray
- xmltodict
- xradar
6 changes: 3 additions & 3 deletions notebooks/basics/wradlib_workflow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -593,8 +593,8 @@
"metadata": {},
"outputs": [],
"source": [
"xgrid = np.linspace(R.x.min(), R.x.mean(), 100)\n",
"ygrid = np.linspace(R.y.min(), R.y.mean(), 100)\n",
"xgrid = np.linspace(R.x.min().values, R.x.mean().values, 100)\n",
"ygrid = np.linspace(R.y.min().values, R.y.mean().values, 100)\n",
"cart = xr.Dataset(coords={\"x\": ([\"x\"], xgrid), \"y\": ([\"y\"], ygrid)})\n",
"cart"
]
Expand Down Expand Up @@ -964,7 +964,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.0"
"version": "3.12.4"
},
"toc": {
"colors": {
Expand Down
75 changes: 57 additions & 18 deletions notebooks/fileio/radolan/radolan_network.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@
"import matplotlib as mpl\n",
"import warnings\n",
"from IPython import get_ipython\n",
"from wetterdienst.provider.dwd.radar import DwdRadarParameter, DwdRadarValues\n",
"from wetterdienst.provider.dwd.radar.api import DwdRadarSites\n",
"\n",
"warnings.filterwarnings(\"ignore\")\n",
"try:\n",
Expand All @@ -56,16 +54,39 @@
"metadata": {},
"outputs": [],
"source": [
"# load radolan data\n",
"start_date = datetime.datetime.utcnow()\n",
"import urllib3\n",
"import os\n",
"import io\n",
"import glob\n",
"import shutil\n",
"import datetime"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"f = \"raa01-rw_10000-latest-dwd---bin.bz2\"\n",
"opendata_url1 = f\"https://opendata.dwd.de/weather/radar/radolan/rw/\"\n",
"\n",
"radar_data = DwdRadarValues(\n",
" parameter=DwdRadarParameter.RADOLAN_CDC.RW_REFLECTIVITY,\n",
" start_date=start_date - datetime.timedelta(hours=2),\n",
" end_date=start_date,\n",
")\n",
"import certifi\n",
"\n",
"results = radar_data.query()"
"http = urllib3.PoolManager(cert_reqs=\"CERT_REQUIRED\", ca_certs=certifi.where())\n",
"with http.request(\n",
" \"GET\", os.path.join(opendata_url1, f), preload_content=False\n",
") as r, open(f, \"wb\") as out:\n",
" shutil.copyfileobj(r, out)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!bzip2 -df $f"
]
},
{
Expand All @@ -74,7 +95,7 @@
"metadata": {},
"outputs": [],
"source": [
"rwdata, rwattrs = wrl.io.read_radolan_composite(next(results).data)"
"rwdata, rwattrs = wrl.io.read_radolan_composite(f[:-4])"
]
},
{
Expand Down Expand Up @@ -137,8 +158,26 @@
"metadata": {},
"outputs": [],
"source": [
"# get radar dict\n",
"radars = DwdRadarSites()"
"radars = dict(\n",
" asb=dict(name=\"ASR Borkum\", lat=53.564011, lon=6.748292, alt=36.0),\n",
" boo=dict(name=\"Boostedt\", lat=54.00438, lon=10.04687, alt=124.56),\n",
" drs=dict(name=\"Dresden\", lat=51.12465, lon=13.76865, alt=263.36),\n",
" eis=dict(name=\"Eisberg\", lat=49.54066, lon=12.40278, alt=798.79),\n",
" emd=dict(name=\"Emden\", lat=53.33872, lon=7.02377, alt=58.0),\n",
" ess=dict(name=\"Essen\", lat=51.40563, lon=6.96712, alt=185.1),\n",
" fbg=dict(name=\"Feldberg\", lat=47.87361, lon=8.00361, alt=1516.1),\n",
" fld=dict(name=\"Flechtdorf\", lat=51.31120, lon=8.802, alt=627.88),\n",
" hnr=dict(name=\"Hannover\", lat=52.46008, lon=9.69452, alt=97.66),\n",
" neu=dict(name=\"Neuhaus\", lat=50.50012, lon=11.13504, alt=878.04),\n",
" nhb=dict(name=\"Neuheilenbach\", lat=50.10965, lon=6.54853, alt=585.84),\n",
" oft=dict(name=\"Offenthal\", lat=49.9847, lon=8.71293, alt=245.8),\n",
" pro=dict(name=\"Prötzel\", lat=52.64867, lon=13.85821, alt=193.92),\n",
" mem=dict(name=\"Memmingen\", lat=48.04214, lon=10.21924, alt=724.4),\n",
" ros=dict(name=\"Rostock\", lat=54.17566, lon=12.05808, alt=37.0),\n",
" isn=dict(name=\"Isen\", lat=48.17470, lon=12.10177, alt=677.77),\n",
" tur=dict(name=\"Türkheim\", lat=48.58528, lon=9.78278, alt=767.62),\n",
" umd=dict(name=\"Ummendorf\", lat=52.16009, lon=11.17609, alt=183.0),\n",
")"
]
},
{
Expand All @@ -148,7 +187,7 @@
"outputs": [],
"source": [
"def plot_radar(radar, ax, proj):\n",
" site = (radar[\"longitude\"], radar[\"latitude\"], radar[\"heightantenna\"])\n",
" site = (radar[\"lon\"], radar[\"lat\"], radar[\"alt\"])\n",
"\n",
" # build polygons for maxrange rangering\n",
" polygons = wrl.georef.spherical_to_polyvert(r, az, 0, site, crs=proj)\n",
Expand All @@ -168,7 +207,7 @@
"\n",
" # plot radar location and information text\n",
" ax.plot(x_loc, y_loc, \"r+\")\n",
" ax.text(x_loc, y_loc, radar[\"location\"], color=\"r\")"
" ax.text(x_loc, y_loc, radar[\"name\"], color=\"r\")"
]
},
{
Expand All @@ -193,7 +232,7 @@
" # get radar coords etc from dict\n",
" if radar_id == \"mhp\":\n",
" continue\n",
" radar = radars.by_odimcode(radar_id)\n",
" radar = radars[radar_id]\n",
" plot_radar(radar, ax1, proj_wgs)"
]
},
Expand Down Expand Up @@ -222,7 +261,7 @@
" # get radar coords etc from dict\n",
" if radar_id == \"mhp\":\n",
" continue\n",
" radar = radars.by_odimcode(radar_id)\n",
" radar = radars[radar_id]\n",
" plot_radar(radar, ax2, proj_stereo)"
]
}
Expand All @@ -239,7 +278,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.0"
"version": "3.12.4"
},
"toc": {
"colors": {
Expand Down
Loading
Loading