Skip to content

Commit 6a464ee

Browse files
committed
merge with dev
2 parents df4d35a + d58b2c4 commit 6a464ee

16 files changed

+8859
-7438
lines changed

ci/environment-ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ dependencies:
1313
- cartopy
1414
- cvxopt
1515
- wradlib
16-
- xarray<2024.10.0
17-
- boto3
16+
- xarray
17+
- boto3<1.37
1818
- xradar
1919
- metpy
2020
- pytest-cov

config/pyart/mch_config.py

+3,831-3,350
Large diffs are not rendered by default.

config/pyart/mf_config.py

+4,348-3,699
Large diffs are not rendered by default.

doc/source/notebooks/retrieve_meteoswiss_data_from_cscs.ipynb

+10-10
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
},
3535
{
3636
"cell_type": "code",
37-
"execution_count": 11,
37+
"execution_count": null,
3838
"metadata": {},
3939
"outputs": [
4040
{
@@ -56,7 +56,7 @@
5656
"T0 = datetime.datetime(2024,5,10,10,10)\n",
5757
"T1 = datetime.datetime(2024,5,10,10,20)\n",
5858
"\n",
59-
"files = retrieve_mch_prod(OUTPUT_DIRECTORY ,T0, T1, product_name='MLA')\n",
59+
"files = retrieve_mch_prod(T0, T1, product_name='MLA', folder_out = OUTPUT_DIRECTORY)\n",
6060
"\n",
6161
"print(len(files))\n",
6262
"print(files[0])\n",
@@ -79,7 +79,7 @@
7979
},
8080
{
8181
"cell_type": "code",
82-
"execution_count": 12,
82+
"execution_count": null,
8383
"metadata": {},
8484
"outputs": [
8585
{
@@ -92,7 +92,7 @@
9292
}
9393
],
9494
"source": [
95-
"files = retrieve_mch_prod(OUTPUT_DIRECTORY ,T0, T1, product_name='MLA', sweeps = [1,2,3,4])\n",
95+
"files = retrieve_mch_prod(T0, T1, product_name='MLA', folder_out = OUTPUT_DIRECTORY, sweeps = [1,2,3,4])\n",
9696
"print(len(files))\n",
9797
"print(files[0:4])"
9898
]
@@ -106,7 +106,7 @@
106106
},
107107
{
108108
"cell_type": "code",
109-
"execution_count": 13,
109+
"execution_count": null,
110110
"metadata": {},
111111
"outputs": [
112112
{
@@ -119,7 +119,7 @@
119119
}
120120
],
121121
"source": [
122-
"files = retrieve_mch_prod(OUTPUT_DIRECTORY ,T0, T1, product_name='RZC')\n",
122+
"files = retrieve_mch_prod(T0, T1, product_name='RZC', folder_out = OUTPUT_DIRECTORY)\n",
123123
"print(len(files))\n",
124124
"print(files)"
125125
]
@@ -133,7 +133,7 @@
133133
},
134134
{
135135
"cell_type": "code",
136-
"execution_count": 14,
136+
"execution_count": null,
137137
"metadata": {},
138138
"outputs": [
139139
{
@@ -146,7 +146,7 @@
146146
}
147147
],
148148
"source": [
149-
"files = retrieve_mch_prod(OUTPUT_DIRECTORY ,T0, T1, product_name='CPC', pattern='*00060*')\n",
149+
"files = retrieve_mch_prod(T0, T1, product_name='CPC', folder_out = OUTPUT_DIRECTORY, pattern='*00060*')\n",
150150
"print(len(files))\n",
151151
"print(files)"
152152
]
@@ -167,7 +167,7 @@
167167
},
168168
{
169169
"cell_type": "code",
170-
"execution_count": 15,
170+
"execution_count": null,
171171
"metadata": {},
172172
"outputs": [
173173
{
@@ -191,7 +191,7 @@
191191
"source": [
192192
"T0 = datetime.datetime(2024,5,10,8,10)\n",
193193
"T1 = datetime.datetime(2024,5,10,10,20)\n",
194-
"files = retrieve_mch_prod(OUTPUT_DIRECTORY ,T0, T1, product_name='CPC', pattern='^(?!.*00005\\.801\\.gif$).*\\.gif$', pattern_type='regex')\n",
194+
"files = retrieve_mch_prod(T0, T1, product_name='CPC', folder_out = OUTPUT_DIRECTORY, pattern='^(?!.*00005\\.801\\.gif$).*\\.gif$', pattern_type='regex')\n",
195195
"\n",
196196
"print(files)"
197197
]

src/pyrad_proc/pyrad/graph/plots_grid.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def plot_surface(
122122
max_lat = prdcfg["gridMapImageConfig"].get("latmax", 49.5)
123123
embellish = prdcfg["gridMapImageConfig"].get("embellish", True)
124124
colorbar_flag = prdcfg["gridMapImageConfig"].get("colorbar_flag", True)
125-
exact_limits = prdcfg["gridMapImageConfig"].get("exact_limits", 0)
125+
exact_limits = prdcfg["gridMapImageConfig"].get("exact_limits", True)
126126

127127
if exact_limits:
128128
lon_lines = np.arange(min_lon, max_lon + lonstep, lonstep)

src/pyrad_proc/pyrad/graph/plots_vol.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -370,14 +370,19 @@ def plot_ppi_map(
370370
max_lon = prdcfg["ppiMapImageConfig"].get("lonmax", 12.5)
371371
min_lat = prdcfg["ppiMapImageConfig"].get("latmin", 43.5)
372372
max_lat = prdcfg["ppiMapImageConfig"].get("latmax", 49.5)
373+
exact_limits = prdcfg["ppiMapImageConfig"].get("exact_limits", True)
373374
resolution = prdcfg["ppiMapImageConfig"].get("mapres", "110m")
374375
if resolution not in ("110m", "50m", "10m"):
375376
warn("Unknown map resolution: " + resolution)
376377
resolution = "110m"
377378
background_zoom = prdcfg["ppiMapImageConfig"].get("background_zoom", 8)
378379

379-
lon_lines = np.arange(np.floor(min_lon), np.ceil(max_lon) + 1, lonstep)
380-
lat_lines = np.arange(np.floor(min_lat), np.ceil(max_lat) + 1, latstep)
380+
if exact_limits:
381+
lon_lines = np.arange(min_lon, max_lon + lonstep, lonstep)
382+
lat_lines = np.arange(min_lat, max_lat + latstep, latstep)
383+
else:
384+
lon_lines = np.arange(np.floor(min_lon), np.ceil(max_lon) + 1, lonstep)
385+
lat_lines = np.arange(np.floor(min_lat), np.ceil(max_lat) + 1, latstep)
381386

382387
fig = plt.figure(figsize=[xsize, ysize], dpi=dpi)
383388

src/pyrad_proc/pyrad/io/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@
234234
from .read_data_other import read_intercomp_scores_ts, read_quantiles # noqa
235235
from .read_data_other import read_selfconsistency, read_colocated_gates # noqa
236236
from .read_data_other import read_colocated_data, read_antenna_pattern # noqa
237+
from .read_data_other import read_colocated_data_time_avg # noqa
237238
from .read_data_other import read_last_state, read_rhi_profile, read_centroids # noqa
238239
from .read_data_other import read_excess_gates, read_histogram # noqa
239240
from .read_data_other import read_profile_ts, read_histogram_ts # noqa
@@ -253,7 +254,7 @@
253254
from .read_data_sensor import read_trt_thundertracking_traj_data # noqa
254255
from .read_data_sensor import read_coord_sensors, read_disdro_parsivel # noqa
255256
from .read_data_sensor import read_knmi # noqa
256-
from .read_data_sensor import (# noqa
257+
from .read_data_sensor import ( # noqa
257258
read_radiosounding_wyoming,
258259
read_radiosounding_igra,
259260
)

src/pyrad_proc/pyrad/io/io_aux.py

+1
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@
216216
"elevation_angle": "elevation_angle",
217217
"min_vis_elevation": "min_vis_elevation",
218218
"min_vis_altitude": "min_vis_altitude",
219+
"min_vis_altitude_above_ground": "min_vis_altitude_above_ground",
219220
"incident_angle": "incident_angle",
220221
"sigma_0": "sigma_0",
221222
"effective_area": "effective_area",

src/pyrad_proc/pyrad/io/read_data_dem.py

+22-29
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import pathlib
1919
from warnings import warn
2020
import numpy as np
21-
import pandas as pd
2221
from scipy.interpolate import RegularGridInterpolator
2322

2423
# check existence of gdal
@@ -343,39 +342,33 @@ def read_ascii_data(fname, fill_value=None):
343342

344343
# read the data
345344
try:
346-
asciidata = pd.read_csv(fname, header=None)
347-
348-
metadata = {}
349-
metadata["columns"] = int(asciidata.iloc[0][0].split(" ")[1])
350-
metadata["rows"] = int(asciidata.iloc[1][0].split(" ")[1])
351-
metadata["min. X"] = float(asciidata.iloc[2][0].split(" ")[1])
352-
metadata["min. Y"] = float(asciidata.iloc[3][0].split(" ")[1])
353-
metadata["resolution"] = float(asciidata.iloc[4][0].split(" ")[1])
354-
metadata["flag value"] = float(asciidata.iloc[5][0].split(" ")[1])
355-
metadata["max. X"] = (
356-
metadata["min. X"] + metadata["resolution"] * metadata["columns"]
357-
)
358-
metadata["max. Y"] = (
359-
metadata["min. Y"] + metadata["resolution"] * metadata["rows"]
360-
)
361-
metadata["value units"] = "m"
345+
with open(fname, "r") as file:
346+
lines = [file.readline().strip().split() for _ in range(6)]
347+
348+
# Parse metadata
349+
metadata = {
350+
"columns": int(lines[0][1]),
351+
"rows": int(lines[1][1]),
352+
"min. X": float(lines[2][1]),
353+
"min. Y": float(lines[3][1]),
354+
"resolution": float(lines[4][1]),
355+
"flag value": float(lines[5][1]),
356+
"max. X": float(lines[2][1]) + float(lines[4][1]) * int(lines[0][1]),
357+
"max. Y": float(lines[3][1]) + float(lines[4][1]) * int(lines[1][1]),
358+
"value units": "m",
359+
}
362360

363-
if not fill_value:
361+
# Set fill value if not provided
362+
if fill_value is None:
364363
fill_value = metadata["flag value"]
365364

366-
raster_array = pd.read_csv(fname, skiprows=6, header=None, sep=" ")
367-
raster_array = np.array(raster_array)
368-
raster_array = raster_array[np.isfinite(raster_array)]
369-
raster_array = np.reshape(raster_array, (metadata["rows"], metadata["columns"]))
370-
raster_array = np.ma.masked_equal(raster_array, fill_value)
365+
# Read raster data, skipping first 6 lines
366+
raster_array = np.loadtxt(fname, skiprows=6)
371367

372-
rasterarray = pd.read_csv(fname, skiprows=6, header=None, sep=" ")
373-
rasterarray = np.array(rasterarray)
374-
rasterarray = rasterarray[np.isfinite(rasterarray)]
375-
rasterarray = np.reshape(rasterarray, (metadata["rows"], metadata["columns"]))
376-
rasterarray = np.ma.masked_equal(rasterarray, fill_value)
368+
# Mask NODATA values
369+
raster_array = np.ma.masked_equal(raster_array, fill_value)
377370

378-
dem = {"metadata": metadata, "data": rasterarray}
371+
dem = {"metadata": metadata, "data": raster_array}
379372

380373
return dem
381374

src/pyrad_proc/pyrad/io/write_data.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666

6767
from pyart.config import get_fillvalue, get_field_colormap, get_field_limits
6868
from pyart.core import antenna_to_cartesian, cartesian_to_geographic_aeqd
69-
from pyart.graph.cm import cmap_d
69+
from cmweather.cm import cmap_d
7070

7171
from .io_aux import generate_field_name_str
7272
from .flock_utils import lock_file, unlock_file

src/pyrad_proc/pyrad/proc/__init__.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
3535
process_raw_grid
3636
process_grid
37+
process_grid_stats
3738
process_grid_point
3839
process_grid_multiple_points
3940
process_grid_time_stats
@@ -273,7 +274,11 @@
273274
from .process_aux import process_moving_azimuthal_average # noqa
274275

275276
from .process_grid import process_grid, process_raw_grid, process_grid_point # noqa
276-
from .process_grid import process_grid_time_stats, process_grid_time_stats2 # noqa
277+
from .process_grid import ( # noqa
278+
process_grid_time_stats,
279+
process_grid_time_stats2,
280+
process_grid_stats,
281+
)
277282
from .process_grid import process_grid_fields_diff, process_grid_mask # noqa
278283
from .process_grid import process_normalize_luminosity, process_pixel_filter # noqa
279284
from .process_grid import process_grid_texture, process_grid_multiple_points # noqa
@@ -353,12 +358,12 @@
353358
from .process_monitoring import process_monitoring # noqa
354359

355360
from .process_retrieve import process_signal_power, process_snr, process_ccor # noqa
356-
from .process_retrieve import ( # noqa
361+
from .process_retrieve import ( # noqa
357362
process_l,
358363
process_cdr,
359364
process_bird_density,
360365
process_refl_from_zdr,
361-
)
366+
)
362367
from .process_retrieve import process_rainrate, process_vol_refl, process_rcs # noqa
363368
from .process_retrieve import process_rcs_pr, process_rainfall_accumulation # noqa
364369
from .process_retrieve import process_radial_noise_hs, process_vpr # noqa

src/pyrad_proc/pyrad/proc/process_aux.py

+3
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,9 @@ def get_process_func(dataset_type, dsname):
298298
elif dataset_type == "GRID_MASK":
299299
func_name = "process_grid_mask"
300300
dsformat = "GRID"
301+
elif dataset_type == "GRID_STATS":
302+
func_name = "process_grid_stats"
303+
dsformat = "GRID"
301304
elif dataset_type == "GRID_TEXTURE":
302305
func_name = "process_grid_texture"
303306
dsformat = "GRID"

0 commit comments

Comments
 (0)