cavapy 2.0.5__tar.gz → 2.0.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cavapy-2.0.5 → cavapy-2.0.7}/PKG-INFO +1 -1
- {cavapy-2.0.5 → cavapy-2.0.7}/cavapy/cava_download.py +17 -0
- {cavapy-2.0.5 → cavapy-2.0.7}/cavapy/cavapy.py +2 -1
- {cavapy-2.0.5 → cavapy-2.0.7}/pyproject.toml +1 -1
- {cavapy-2.0.5 → cavapy-2.0.7}/LICENSE +0 -0
- {cavapy-2.0.5 → cavapy-2.0.7}/README.md +0 -0
- {cavapy-2.0.5 → cavapy-2.0.7}/cavapy/__init__.py +0 -0
- {cavapy-2.0.5 → cavapy-2.0.7}/cavapy/cava_bias.py +0 -0
- {cavapy-2.0.5 → cavapy-2.0.7}/cavapy/cava_config.py +0 -0
- {cavapy-2.0.5 → cavapy-2.0.7}/cavapy/cava_plot.py +0 -0
- {cavapy-2.0.5 → cavapy-2.0.7}/cavapy/cava_validation.py +0 -0
|
@@ -32,6 +32,22 @@ SPATIAL_COORDS = {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
|
|
35
|
+
def _normalize_longitude_coordinate(data: xr.DataArray) -> xr.DataArray:
|
|
36
|
+
"""Normalize 0-360 longitude coordinates to -180..180 for bbox selection."""
|
|
37
|
+
if "longitude" not in data.coords:
|
|
38
|
+
return data
|
|
39
|
+
|
|
40
|
+
longitude = data["longitude"]
|
|
41
|
+
values = np.asarray(longitude.values, dtype=float)
|
|
42
|
+
if values.ndim != 1 or values.size == 0:
|
|
43
|
+
return data
|
|
44
|
+
if np.nanmax(values) <= 180:
|
|
45
|
+
return data
|
|
46
|
+
|
|
47
|
+
data = data.assign_coords(longitude=(longitude + 180) % 360 - 180)
|
|
48
|
+
return data.sortby("longitude")
|
|
49
|
+
|
|
50
|
+
|
|
35
51
|
@contextmanager
|
|
36
52
|
def _suppress_stderr_fd():
|
|
37
53
|
"""Temporarily redirect stderr to /dev/null (also silences C-level warnings)."""
|
|
@@ -108,6 +124,7 @@ def _select_spatial_subset(
|
|
|
108
124
|
log: logging.Logger,
|
|
109
125
|
) -> xr.DataArray:
|
|
110
126
|
"""Select bbox cells, falling back to nearest cells if the bbox is sub-grid."""
|
|
127
|
+
data = _normalize_longitude_coordinate(data)
|
|
111
128
|
selectors = {
|
|
112
129
|
coord_name: _coordinate_slice(data[coord_name], bbox[bbox_key])
|
|
113
130
|
for coord_name, bbox_key in SPATIAL_COORDS.items()
|
|
@@ -386,7 +386,8 @@ def get_climate_data(
|
|
|
386
386
|
historical (bool): Flag to indicate if processing historical data (default: False).
|
|
387
387
|
If True, historical data is provided together with projections.
|
|
388
388
|
Historical simulation runs for CORDEX-CORE initiative are provided for the 1980-2005 time period.
|
|
389
|
-
buffer (int): Buffer
|
|
389
|
+
buffer (int): Buffer in coordinate degrees added to each side of the bbox,
|
|
390
|
+
whether the bbox comes from country bounds or from xlim/ylim (default: 0).
|
|
390
391
|
xlim (tuple or None): Longitudinal bounds of the region of interest. Use only when country is None (default: None).
|
|
391
392
|
ylim (tuple or None): Latitudinal bounds of the region of interest. Use only when country is None (default: None).
|
|
392
393
|
remote (bool): Flag to work with remote data or not (default: True).
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|