pycontrails 0.53.0__cp311-cp311-macosx_10_9_x86_64.whl → 0.54.0__cp311-cp311-macosx_10_9_x86_64.whl

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.

Potentially problematic release.


This version of pycontrails might be problematic. Click here for more details.

pycontrails/_version.py CHANGED
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '0.53.0'
16
- __version_tuple__ = version_tuple = (0, 53, 0)
15
+ __version__ = version = '0.54.0'
16
+ __version_tuple__ = version_tuple = (0, 54, 0)
@@ -1151,7 +1151,9 @@ class Flight(GeoVectorDataset):
1151
1151
  out.data.pop("level", None) # avoid any ambiguity
1152
1152
  return out
1153
1153
 
1154
- def distance_to_coords(self: Flight, distance: ArrayOrFloat) -> tuple[
1154
+ def distance_to_coords(
1155
+ self: Flight, distance: ArrayOrFloat
1156
+ ) -> tuple[
1155
1157
  ArrayOrFloat,
1156
1158
  ArrayOrFloat,
1157
1159
  np.intp | npt.NDArray[np.intp],
@@ -1073,7 +1073,6 @@ class VectorDataset:
1073
1073
 
1074
1074
  # Convert numpy objects to python objects
1075
1075
  if isinstance(obj, np.ndarray | np.generic):
1076
-
1077
1076
  # round time to unix seconds
1078
1077
  if key == "time":
1079
1078
  return np_encoder.default(obj.astype("datetime64[s]").astype(int))
@@ -79,12 +79,12 @@ def parse_timesteps(time: TimeInput | None, freq: str | None = "1h") -> list[dat
79
79
  elif len(time) == 1:
80
80
  time = (time[0], time[0])
81
81
  elif len(time) != 2:
82
- msg = f"Input time bounds must have length < 2 and > 0, got {len(time)}"
82
+ msg = f"Input time bounds must have length 1 or 2, got {len(time)}"
83
83
  raise ValueError(msg)
84
84
 
85
85
  # convert all to pandas Timestamp
86
86
  try:
87
- timestamps = [pd.to_datetime(t) for t in time]
87
+ t0, t1 = (pd.to_datetime(t) for t in time)
88
88
  except ValueError as e:
89
89
  msg = (
90
90
  f"Failed to parse time input {time}. "
@@ -93,10 +93,13 @@ def parse_timesteps(time: TimeInput | None, freq: str | None = "1h") -> list[dat
93
93
  raise ValueError(msg) from e
94
94
 
95
95
  if freq is None:
96
- daterange = pd.DatetimeIndex([timestamps[0], timestamps[1]])
96
+ daterange = pd.DatetimeIndex([t0, t1])
97
97
  else:
98
98
  # get date range that encompasses all whole hours
99
- daterange = pd.date_range(timestamps[0].floor(freq), timestamps[1].ceil(freq), freq=freq)
99
+ daterange = pd.date_range(t0.floor(freq), t1.ceil(freq), freq=freq)
100
+ if len(daterange) == 0:
101
+ msg = f"Time range {t0} to {t1} with freq {freq} has no valid time steps."
102
+ raise ValueError(msg)
100
103
 
101
104
  # return list of datetimes
102
105
  return daterange.to_pydatetime().tolist()
@@ -638,7 +641,7 @@ class MetDataSource(abc.ABC):
638
641
 
639
642
  - chunks: {"time": 1}
640
643
  - engine: "netcdf4"
641
- - parallel: True
644
+ - parallel: False
642
645
 
643
646
  Returns
644
647
  -------
@@ -2,12 +2,23 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from pycontrails.datalib.ecmwf.arco_era5 import ARCOERA5
5
+ from pycontrails.datalib.ecmwf.arco_era5 import (
6
+ ARCOERA5,
7
+ open_arco_era5_model_level_data,
8
+ open_arco_era5_single_level,
9
+ )
10
+ from pycontrails.datalib.ecmwf.common import CDSCredentialsNotFound
6
11
  from pycontrails.datalib.ecmwf.era5 import ERA5
7
12
  from pycontrails.datalib.ecmwf.era5_model_level import ERA5ModelLevel
8
13
  from pycontrails.datalib.ecmwf.hres import HRES
9
14
  from pycontrails.datalib.ecmwf.hres_model_level import HRESModelLevel
10
15
  from pycontrails.datalib.ecmwf.ifs import IFS
16
+ from pycontrails.datalib.ecmwf.model_levels import (
17
+ MODEL_LEVELS_PATH,
18
+ ml_to_pl,
19
+ model_level_pressure,
20
+ model_level_reference_pressure,
21
+ )
11
22
  from pycontrails.datalib.ecmwf.variables import (
12
23
  ECMWF_VARIABLES,
13
24
  MODEL_LEVEL_VARIABLES,
@@ -16,6 +27,7 @@ from pycontrails.datalib.ecmwf.variables import (
16
27
  CloudAreaFraction,
17
28
  CloudAreaFractionInLayer,
18
29
  Divergence,
30
+ OzoneMassMixingRatio,
19
31
  PotentialVorticity,
20
32
  RelativeHumidity,
21
33
  RelativeVorticity,
@@ -29,14 +41,21 @@ from pycontrails.datalib.ecmwf.variables import (
29
41
 
30
42
  __all__ = [
31
43
  "ARCOERA5",
44
+ "CDSCredentialsNotFound",
32
45
  "ERA5",
33
46
  "ERA5ModelLevel",
34
47
  "HRES",
35
48
  "HRESModelLevel",
36
49
  "IFS",
50
+ "model_level_reference_pressure",
51
+ "model_level_pressure",
52
+ "ml_to_pl",
53
+ "open_arco_era5_model_level_data",
54
+ "open_arco_era5_single_level",
37
55
  "CloudAreaFraction",
38
56
  "CloudAreaFractionInLayer",
39
57
  "Divergence",
58
+ "OzoneMassMixingRatio",
40
59
  "PotentialVorticity",
41
60
  "RelativeHumidity",
42
61
  "RelativeVorticity",
@@ -47,7 +66,8 @@ __all__ = [
47
66
  "TopNetSolarRadiation",
48
67
  "TopNetThermalRadiation",
49
68
  "ECMWF_VARIABLES",
69
+ "MODEL_LEVELS_PATH",
70
+ "MODEL_LEVEL_VARIABLES",
50
71
  "PRESSURE_LEVEL_VARIABLES",
51
72
  "SURFACE_VARIABLES",
52
- "MODEL_LEVEL_VARIABLES",
53
73
  ]