doppy 0.3.2__cp310-abi3-win_amd64.whl → 0.3.3__cp310-abi3-win_amd64.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 doppy might be problematic. Click here for more details.

doppy/netcdf.py CHANGED
@@ -1,5 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
+ import pathlib
3
4
  import warnings
4
5
  from types import TracebackType
5
6
  from typing import Literal, TypeAlias
@@ -12,7 +13,7 @@ NetCDFDataType: TypeAlias = Literal["f4", "f8", "i4", "i8", "u4", "u8"]
12
13
 
13
14
 
14
15
  class Dataset:
15
- def __init__(self, filename: str) -> None:
16
+ def __init__(self, filename: str | pathlib.Path) -> None:
16
17
  self.nc = netCDF4.Dataset(filename, mode="w")
17
18
 
18
19
  def __enter__(self) -> Dataset:
doppy/product/stare.py CHANGED
@@ -115,6 +115,67 @@ class Stare:
115
115
  system_id=raw.header.system_id,
116
116
  )
117
117
 
118
+ def write_to_netcdf(self, filename: str | Path) -> None:
119
+ with doppy.netcdf.Dataset(filename) as nc:
120
+ nc.add_dimension("time")
121
+ nc.add_dimension("range")
122
+ nc.add_time(
123
+ name="time",
124
+ dimensions=("time",),
125
+ standard_name="time",
126
+ long_name="Time UTC",
127
+ data=self.time,
128
+ dtype="f8",
129
+ )
130
+ nc.add_variable(
131
+ name="range",
132
+ dimensions=("range",),
133
+ units="m",
134
+ data=self.radial_distance,
135
+ dtype="f4",
136
+ )
137
+ nc.add_variable(
138
+ name="elevation",
139
+ dimensions=("time",),
140
+ units="degrees",
141
+ data=self.elevation,
142
+ dtype="f4",
143
+ long_name="elevation from horizontal",
144
+ )
145
+ nc.add_variable(
146
+ name="beta_raw",
147
+ dimensions=("time", "range"),
148
+ units="sr-1 m-1",
149
+ data=self.beta,
150
+ dtype="f4",
151
+ )
152
+ nc.add_variable(
153
+ name="beta",
154
+ dimensions=("time", "range"),
155
+ units="sr-1 m-1",
156
+ data=self.beta,
157
+ dtype="f4",
158
+ mask=self.mask,
159
+ )
160
+ nc.add_variable(
161
+ name="v",
162
+ dimensions=("time", "range"),
163
+ units="m s-1",
164
+ long_name="Doppler velocity",
165
+ data=self.radial_velocity,
166
+ dtype="f4",
167
+ mask=self.mask,
168
+ )
169
+ nc.add_scalar_variable(
170
+ name="wavelength",
171
+ units="m",
172
+ standard_name="radiation_wavelength",
173
+ data=self.wavelength,
174
+ dtype="f4",
175
+ )
176
+ nc.add_attribute("serial_number", self.system_id)
177
+ nc.add_attribute("doppy_version", doppy.__version__)
178
+
118
179
 
119
180
  def _compute_noise_mask(
120
181
  intensity: npt.NDArray[np.float64],
@@ -8,6 +8,7 @@ from typing import Sequence
8
8
  import numpy as np
9
9
  import numpy.typing as npt
10
10
 
11
+ import doppy
11
12
  from doppy import options
12
13
  from doppy.product.stare import Stare
13
14
 
@@ -178,3 +179,103 @@ class StareDepol:
178
179
  bg_correction_method=bg_correction_method,
179
180
  )
180
181
  return cls(co, cross, polariser_bleed_through)
182
+
183
+ def write_to_netcdf(self, filename: str | Path) -> None:
184
+ with doppy.netcdf.Dataset(filename) as nc:
185
+ nc.add_dimension("time")
186
+ nc.add_dimension("range")
187
+ nc.add_time(
188
+ name="time",
189
+ dimensions=("time",),
190
+ standard_name="time",
191
+ long_name="Time UTC",
192
+ data=self.time,
193
+ dtype="f8",
194
+ )
195
+ nc.add_variable(
196
+ name="range",
197
+ dimensions=("range",),
198
+ units="m",
199
+ data=self.radial_distance,
200
+ dtype="f4",
201
+ )
202
+ nc.add_variable(
203
+ name="elevation",
204
+ dimensions=("time",),
205
+ units="degrees",
206
+ data=self.elevation,
207
+ dtype="f4",
208
+ long_name="elevation from horizontal",
209
+ )
210
+ nc.add_variable(
211
+ name="beta_raw",
212
+ dimensions=("time", "range"),
213
+ units="sr-1 m-1",
214
+ data=self.beta,
215
+ dtype="f4",
216
+ )
217
+ nc.add_variable(
218
+ name="beta",
219
+ dimensions=("time", "range"),
220
+ units="sr-1 m-1",
221
+ data=self.beta,
222
+ dtype="f4",
223
+ mask=self.mask,
224
+ )
225
+ nc.add_variable(
226
+ name="v",
227
+ dimensions=("time", "range"),
228
+ units="m s-1",
229
+ long_name="Doppler velocity",
230
+ data=self.radial_velocity,
231
+ dtype="f4",
232
+ mask=self.mask,
233
+ )
234
+ nc.add_scalar_variable(
235
+ name="wavelength",
236
+ units="m",
237
+ standard_name="radiation_wavelength",
238
+ data=self.wavelength,
239
+ dtype="f4",
240
+ )
241
+ nc.add_variable(
242
+ name="depolarisation_raw",
243
+ dimensions=("time", "range"),
244
+ units="1",
245
+ data=self.depolarisation,
246
+ dtype="f4",
247
+ mask=self.mask_depolarisation,
248
+ )
249
+ nc.add_variable(
250
+ name="depolarisation",
251
+ dimensions=("time", "range"),
252
+ units="1",
253
+ data=self.depolarisation,
254
+ dtype="f4",
255
+ mask=self.mask | self.mask_depolarisation,
256
+ )
257
+ nc.add_variable(
258
+ name="beta_cross_raw",
259
+ dimensions=("time", "range"),
260
+ units="sr-1 m-1",
261
+ data=self.beta_cross,
262
+ mask=self.mask_beta_cross,
263
+ dtype="f4",
264
+ )
265
+ nc.add_variable(
266
+ name="beta_cross",
267
+ dimensions=("time", "range"),
268
+ units="sr-1 m-1",
269
+ data=self.beta_cross,
270
+ mask=self.mask | self.mask_beta_cross,
271
+ dtype="f4",
272
+ )
273
+ nc.add_scalar_variable(
274
+ name="polariser_bleed_through",
275
+ units="1",
276
+ long_name="Polariser bleed-through",
277
+ data=self.polariser_bleed_through,
278
+ dtype="f4",
279
+ )
280
+ nc.add_attribute("serial_number", self.system_id)
281
+ nc.add_attribute("doppy_version", doppy.__version__)
doppy/product/wind.py CHANGED
@@ -32,6 +32,7 @@ class Wind:
32
32
  vertical_wind: npt.NDArray[np.float64]
33
33
  mask: npt.NDArray[np.bool_]
34
34
  system_id: str
35
+ options: Options | None
35
36
 
36
37
  @functools.cached_property
37
38
  def horizontal_wind_speed(self) -> npt.NDArray[np.float64]:
@@ -104,6 +105,7 @@ class Wind:
104
105
  vertical_wind=wind[:, :, 2],
105
106
  mask=mask,
106
107
  system_id=raw.header.system_id,
108
+ options=options,
107
109
  )
108
110
 
109
111
  @classmethod
@@ -163,6 +165,7 @@ class Wind:
163
165
  vertical_wind=wind[:, :, 2],
164
166
  mask=mask,
165
167
  system_id=raw.system_id,
168
+ options=options,
166
169
  )
167
170
 
168
171
  @classmethod
@@ -211,8 +214,74 @@ class Wind:
211
214
  vertical_wind=raw.vertical_wind,
212
215
  mask=mask,
213
216
  system_id=raw.system_id,
217
+ options=options,
214
218
  )
215
219
 
220
+ def write_to_netcdf(self, filename: str | Path) -> None:
221
+ with doppy.netcdf.Dataset(filename) as nc:
222
+ nc.add_dimension("time")
223
+ nc.add_dimension("height")
224
+ nc.add_time(
225
+ name="time",
226
+ dimensions=("time",),
227
+ standard_name="time",
228
+ long_name="Time UTC",
229
+ data=self.time,
230
+ dtype="f8",
231
+ )
232
+ nc.add_variable(
233
+ name="height",
234
+ dimensions=("height",),
235
+ units="m",
236
+ data=self.height,
237
+ dtype="f4",
238
+ )
239
+ nc.add_variable(
240
+ name="uwind_raw",
241
+ dimensions=("time", "height"),
242
+ units="m s-1",
243
+ data=self.zonal_wind,
244
+ dtype="f4",
245
+ long_name="Non-screened zonal wind",
246
+ )
247
+ nc.add_variable(
248
+ name="uwind",
249
+ dimensions=("time", "height"),
250
+ units="m s-1",
251
+ data=self.zonal_wind,
252
+ mask=self.mask,
253
+ dtype="f4",
254
+ long_name="Zonal wind",
255
+ )
256
+ nc.add_variable(
257
+ name="vwind_raw",
258
+ dimensions=("time", "height"),
259
+ units="m s-1",
260
+ data=self.meridional_wind,
261
+ dtype="f4",
262
+ long_name="Non-screened meridional wind",
263
+ )
264
+ nc.add_variable(
265
+ name="vwind",
266
+ dimensions=("time", "height"),
267
+ units="m s-1",
268
+ data=self.meridional_wind,
269
+ mask=self.mask,
270
+ dtype="f4",
271
+ long_name="Meridional wind",
272
+ )
273
+ nc.add_attribute("serial_number", self.system_id)
274
+ nc.add_attribute("doppy_version", doppy.__version__)
275
+ if self.options is not None and self.options.azimuth_offset_deg is not None:
276
+ nc.add_scalar_variable(
277
+ name="azimuth_offset",
278
+ units="degrees",
279
+ data=self.options.azimuth_offset_deg,
280
+ dtype="f4",
281
+ long_name="Azimuth offset of the instrument "
282
+ "(positive clockwise from north)",
283
+ )
284
+
216
285
 
217
286
  def _compute_wind(
218
287
  raw: doppy.raw.HaloHpl | doppy.raw.WindCube,
doppy/rs.pyd CHANGED
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: doppy
3
- Version: 0.3.2
3
+ Version: 0.3.3
4
4
  Classifier: Development Status :: 4 - Beta
5
5
  Classifier: Programming Language :: Python :: 3
6
6
  Classifier: Programming Language :: Python :: 3.10
@@ -44,8 +44,8 @@ Project-URL: Bug Tracker, https://github.com/actris-cloudnet/doppy/issues
44
44
 
45
45
  ## Products
46
46
 
47
- - [Stare](https://github.com/actris-cloudnet/doppy/blob/main/src/doppy/product/stare.py): [Examples](https://cloudnet.fmi.fi/search/visualizations?experimental=true&product=doppler-lidar&dateFrom=2024-06-05&dateTo=2024-06-05)
48
- - [Wind](https://github.com/actris-cloudnet/doppy/blob/main/src/doppy/product/wind.py): [Examples](https://cloudnet.fmi.fi/search/visualizations?experimental=true&product=doppler-lidar-wind&dateFrom=2024-06-05&dateTo=2024-06-05)
47
+ - Stare: [src](https://github.com/actris-cloudnet/doppy/blob/main/src/doppy/product/stare.py), [Cloudnet examples](https://cloudnet.fmi.fi/search/visualizations?experimental=true&product=doppler-lidar&dateFrom=2024-06-05&dateTo=2024-06-05)
48
+ - Wind: [src](https://github.com/actris-cloudnet/doppy/blob/main/src/doppy/product/wind.py), [Cloudnet examples](https://cloudnet.fmi.fi/search/visualizations?experimental=true&product=doppler-lidar-wind&dateFrom=2024-06-05&dateTo=2024-06-05)
49
49
 
50
50
  ## Instruments
51
51
 
@@ -61,6 +61,8 @@ pip install doppy
61
61
 
62
62
  ## Usage
63
63
 
64
+ ### Stare
65
+
64
66
  ```python
65
67
  import doppy
66
68
 
@@ -70,68 +72,68 @@ stare = doppy.product.Stare.from_halo_data(
70
72
  bg_correction_method=doppy.options.BgCorrectionMethod.FIT,
71
73
  )
72
74
 
75
+ stare.write_to_netcdf(FILENAME)
76
+ ```
77
+
78
+ ### Stare with depolarisation
79
+
80
+ ```python
81
+ import doppy
82
+
83
+ stare_depol = doppy.product.StareDepol.from_halo_data(
84
+ co_data=LIST_OF_STARE_CO_FILE_PATHS,
85
+ co_data_bg=LIST_OF_BACKGROUND_CO_FILE_PATHS,
86
+ cross_data=LIST_OF_STARE_CROSS_FILE_PATHS,
87
+ cross_data_bg=LIST_OF_BACKGROUND_CROSS_FILE_PATHS,
88
+ bg_correction_method=doppy.options.BgCorrectionMethod.FIT,
89
+ polariser_bleed_through=0,
90
+ )
91
+
92
+ stare_depol.write_to_netcdf(FILENAME)
93
+ ```
94
+
95
+ ### Wind
96
+
97
+ ```python
98
+ import doppy
99
+
100
+ wind = doppy.product.Wind.from_halo_data(
101
+ data=LIST_OF_WIND_SCAN_HPL_FILES,
102
+ )
103
+
104
+ # You can also pass instrument azimuth offset in degrees as an option
105
+ wind = doppy.product.Wind.from_halo_data(
106
+ data=LIST_OF_WIND_SCAN_HPL_FILES,
107
+ options=doppy.product.wind.Options(azimuth_offset_deg=30),
108
+ )
109
+
110
+ # For windcube wls200s use
111
+ wind = doppy.product.Wind.from_windcube_data(
112
+ data=LIST_OF_VAD_NETCDF_FILES,
113
+ )
114
+
115
+ # For windcube wls70 use
116
+ wind = doppy.product.Wind.from_wls70_data(
117
+ data=LIST_OF_RTD_FILES,
118
+ )
119
+
120
+ wind.write_to_netcdf(FILENAME)
121
+ ```
122
+
123
+ ### Raw files
124
+
125
+ ```python
126
+ import doppy
127
+
128
+ # Halo
129
+ raws_hpl = doppy.raw.HaloHpl.from_srcs(LIST_OF_HPL_FILES)
130
+ raws_bg = doppy.raw.HaloBg.from_srcs(LIST_OF_BACKGROUND_FILES)
131
+ raw_system_params = doppy.raw.HaloSysParams.from_src(SYSTEM_PARAMS_FILENAME)
73
132
 
74
- (
75
- doppy.netcdf.Dataset(FILENAME)
76
- .add_dimension("time")
77
- .add_dimension("range")
78
- .add_time(
79
- name="time",
80
- dimensions=("time",),
81
- standard_name="time",
82
- long_name="Time UTC",
83
- data=stare.time,
84
- dtype="f8",
85
- )
86
- .add_variable(
87
- name="range",
88
- dimensions=("range",),
89
- units="m",
90
- data=stare.radial_distance,
91
- dtype="f4",
92
- )
93
- .add_variable(
94
- name="elevation",
95
- dimensions=("time",),
96
- units="degrees",
97
- data=stare.elevation,
98
- dtype="f4",
99
- long_name="elevation from horizontal",
100
- )
101
- .add_variable(
102
- name="beta_raw",
103
- dimensions=("time", "range"),
104
- units="sr-1 m-1",
105
- data=stare.beta,
106
- dtype="f4",
107
- )
108
- .add_variable(
109
- name="beta",
110
- dimensions=("time", "range"),
111
- units="sr-1 m-1",
112
- data=stare.beta,
113
- dtype="f4",
114
- mask=stare.mask,
115
- )
116
- .add_variable(
117
- name="v",
118
- dimensions=("time", "range"),
119
- units="m s-1",
120
- long_name="Doppler velocity",
121
- data=stare.radial_velocity,
122
- dtype="f4",
123
- mask=stare.mask,
124
- )
125
- .add_scalar_variable(
126
- name="wavelength",
127
- units="m",
128
- standard_name="radiation_wavelength",
129
- data=stare.wavelength,
130
- dtype="f4",
131
- )
132
- .add_attribute("serial_number", stare.system_id)
133
- .add_attribute("doppy_version", doppy.__version__)
134
- ).close()
133
+ # Windcube WLS200S
134
+ raws_wls200s = doppy.raw.WindCube.from_vad_srcs(LIST_OF_VAD_NETCDF_FILES)
135
135
 
136
+ # Windcube WLS70
137
+ raws_wls70 = doppy.raw.Wls70.from_srcs(LIST_OF_RTD_FILES)
136
138
  ```
137
139
 
@@ -1,7 +1,7 @@
1
- doppy-0.3.2.dist-info/METADATA,sha256=bQR6PLYTj9KbGk4o_L7UMDMjujoiSy9VQtFCjjwYk9I,4243
2
- doppy-0.3.2.dist-info/WHEEL,sha256=kQSgRz4wLs1NoHeP8cPfiUAbi-20athsJLkIuWHUegk,95
3
- doppy-0.3.2.dist-info/entry_points.txt,sha256=9b_Ca7vJoh6AwL3W8qAPh_UmJ_1Pa6hi-TDfCTDjvSk,43
4
- doppy-0.3.2.dist-info/licenses/LICENSE,sha256=RIAxFjJLTw0wQ3_SM73JoTeppoD99DJJ72cjvVuRrW4,1110
1
+ doppy-0.3.3.dist-info/METADATA,sha256=b_zwBH1KuUMo3_USeeCTdeWta9A6VeNolEzQrUDEQPI,4274
2
+ doppy-0.3.3.dist-info/WHEEL,sha256=kQSgRz4wLs1NoHeP8cPfiUAbi-20athsJLkIuWHUegk,95
3
+ doppy-0.3.3.dist-info/entry_points.txt,sha256=9b_Ca7vJoh6AwL3W8qAPh_UmJ_1Pa6hi-TDfCTDjvSk,43
4
+ doppy-0.3.3.dist-info/licenses/LICENSE,sha256=RIAxFjJLTw0wQ3_SM73JoTeppoD99DJJ72cjvVuRrW4,1110
5
5
  doppy/bench.py,sha256=fLN2iS5mmoYH4qZjD80Vl1h9lp3C-KDfhj9fteWRPtM,260
6
6
  doppy/data/api.py,sha256=c3zbZI3IV7HnzhyFzJpUPOFT20eYFuQlJ5K_1ZEe1Pg,1921
7
7
  doppy/data/cache.py,sha256=VNPB3XsWGwY2bNXBs1r_sEWF4qBq_U7sJSlSmt1Rxm8,1033
@@ -9,11 +9,11 @@ doppy/data/exceptions.py,sha256=JOyekvUO-Ew4ZVezf3_IxZOrPN0IksfUILd8R2YcSts,95
9
9
  doppy/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  doppy/defaults.py,sha256=nhxcZcFd2jyDVbq0azwtekEJEjiz8k21MZmXFlSXAjo,40
11
11
  doppy/exceptions.py,sha256=YNEyz4r0ObzZHZ9re83K3wZlR2CRI1GyhH0vvFGasgQ,148
12
- doppy/netcdf.py,sha256=VkWGleFKef3bkWf2_LfCdJnR1LORIFc51cXDRoRdHFo,4023
12
+ doppy/netcdf.py,sha256=W5YPbsv6CQ2Ycy4sFaIyjfn9YjvDgygczm8j9E1_uAg,4054
13
13
  doppy/options.py,sha256=uyIKM_G2GtbmV6Gve8o13eIShQqUwsnYZ41mhX2ypGE,218
14
- doppy/product/stare.py,sha256=lJlo0DggYSGCFveFCZrY4SHOsU01dcHrV8Naq6bBT7s,21239
15
- doppy/product/stare_depol.py,sha256=kf24wFDs1TBPrNag3URj2By5ermr5Q6RrAC-uNh7xxM,6389
16
- doppy/product/wind.py,sha256=f52owv_pzfUDiMzLXv6IqHFWHWdLXmGUIgBCXjOhPnk,13455
14
+ doppy/product/stare.py,sha256=ipZuRO8Bc5jWDlPYAxDZQ91gR8OMmnK-D7mNiKo2E7I,23322
15
+ doppy/product/stare_depol.py,sha256=Guz2FxSSdgYCltdonnta7CYQ831tAeXTSx-2ax3yQC4,9892
16
+ doppy/product/wind.py,sha256=k1qs10tMrgGKU6e4FdNZ6hh-AgxCwUwGsloyPsmRfwA,15984
17
17
  doppy/product/__init__.py,sha256=xoBEXuhid-bvoof5Ogzpt1dKIhJgNMRyrAinCqUOUUI,241
18
18
  doppy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  doppy/raw/halo_bg.py,sha256=9K7E9smahGOqDIYnA-9m-Di3QsDY0PR2FH4Yd_oYiEY,4951
@@ -25,5 +25,5 @@ doppy/raw/__init__.py,sha256=J06q7iykSAWIif4XAxI1jOszkARvLFBR1eU-B9yUXMw,235
25
25
  doppy/utils.py,sha256=lENDTzMVjCOA15Va9WZ6cou-foL5bGbNt4-NbDcnXpc,223
26
26
  doppy/__init__.py,sha256=Af7_8p3oN1nTqS9fo0mVKVuiKf5CAEK69uQa32CSFBA,197
27
27
  doppy/__main__.py,sha256=38hIWWfanILuBBGorQiAaleSC4qYJoIxuzVBkxf7Dng,371
28
- doppy/rs.pyd,sha256=wiTo_4GBwfKe2bWxcvc1rLHOIPRL-Q22ieLuXuaX_5w,2100736
29
- doppy-0.3.2.dist-info/RECORD,,
28
+ doppy/rs.pyd,sha256=wyre5zbKBqTawf54YUiBTexkPu1A67UKTVgjmSNDDwI,2100736
29
+ doppy-0.3.3.dist-info/RECORD,,
File without changes