cloudnetpy-qc 1.26.1__py3-none-any.whl → 1.26.3__py3-none-any.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.
cloudnetpy_qc/coverage.py CHANGED
@@ -22,7 +22,7 @@ DEFAULT_RESOLUTION = datetime.timedelta(seconds=30)
22
22
 
23
23
  def data_coverage(
24
24
  nc: netCDF4.Dataset,
25
- ) -> tuple[float, datetime.timedelta, datetime.timedelta] | None:
25
+ ) -> tuple[float | np.floating, datetime.timedelta, datetime.timedelta] | None:
26
26
  time = np.array(nc["time"][:])
27
27
  time_unit = datetime.timedelta(hours=1)
28
28
  try:
cloudnetpy_qc/quality.py CHANGED
@@ -238,7 +238,7 @@ class FindVariableOutliers(Test):
238
238
  if key == "height" and self.product == Product.CPR:
239
239
  return None
240
240
  if key == "air_pressure":
241
- pressure = utils.calc_pressure(self.nc["altitude"][:])
241
+ pressure = utils.calc_pressure(np.mean(self.nc["altitude"][:]))
242
242
  max_diff = pressure * 0.05
243
243
  return (pressure - max_diff, pressure + max_diff)
244
244
  if not DATA_CONFIG.has_option("limits", key):
@@ -914,7 +914,7 @@ class TestCFConvention(Test):
914
914
  description = "Test compliance with the CF metadata conventions."
915
915
 
916
916
  def run(self):
917
- from cfchecker import cfchecks
917
+ from cfchecker import cfchecks # noqa: PLC0415
918
918
 
919
919
  cf_version = "1.8"
920
920
  inst = cfchecks.CFChecker(
@@ -1005,23 +1005,44 @@ class TestInstrumentPid(Test):
1005
1005
  received = str(getattr(self.nc, key))
1006
1006
  except AttributeError:
1007
1007
  return
1008
- items = self._get_value("21.T11148/eb3c713572f681e6c4c3")
1009
- if not isinstance(items, list):
1010
- return
1011
- model_name = self._get_value("21.T11148/c1a0ec5ad347427f25d6")["modelName"]
1012
- for item in items:
1013
- if item["alternateIdentifier"]["alternateIdentifierType"] == "SerialNumber":
1014
- expected = item["alternateIdentifier"]["alternateIdentifierValue"]
1008
+ expected = self._get_serial_number()
1009
+ if expected is None:
1010
+ self._add_warning(
1011
+ f"No serial number was defined in instrument PID "
1012
+ f"but found '{received}' in the file."
1013
+ )
1014
+ elif received != expected:
1015
+ msg = self._create_message(expected, received, "serial number")
1016
+ self._add_error(msg)
1017
+
1018
+ def _get_serial_number(self) -> str | None:
1019
+ # Exception for L'Aquila LPM whose serial number changed when wind
1020
+ # sensors were added.
1021
+ if (
1022
+ self.nc.instrument_pid
1023
+ == "https://hdl.handle.net/21.12132/3.7cd404bd07d74e93"
1024
+ ):
1025
+ return "3629" if self._get_date() <= datetime.date(2023, 10, 23) else "3778"
1026
+ idents = self._get_value("21.T11148/eb3c713572f681e6c4c3")
1027
+ if not isinstance(idents, list):
1028
+ return None
1029
+ model = self._get_value("21.T11148/c1a0ec5ad347427f25d6")
1030
+ if not isinstance(model, dict):
1031
+ return None
1032
+ model_name = model["modelName"]
1033
+ for ident in idents:
1034
+ if (
1035
+ ident["alternateIdentifier"]["alternateIdentifierType"]
1036
+ == "SerialNumber"
1037
+ ):
1038
+ serial_number = ident["alternateIdentifier"]["alternateIdentifierValue"]
1015
1039
  if "StreamLine" in model_name:
1016
- expected = expected.split("-")[-1]
1017
- if received != expected:
1018
- msg = self._create_message(expected, received, "serial number")
1019
- self._add_error(msg)
1020
- return
1021
- self._add_warning(
1022
- f"No serial number was defined in instrument PID "
1023
- f"but found '{received}' in the file."
1024
- )
1040
+ serial_number = serial_number.split("-")[-1]
1041
+ return serial_number
1042
+ return None
1043
+
1044
+ def _get_date(self):
1045
+ return datetime.date(int(self.nc.year), int(self.nc.month), int(self.nc.day))
1025
1046
 
1026
1047
  def _check_model_name(self):
1027
1048
  key = "source"
cloudnetpy_qc/version.py CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  MAJOR = 1
4
4
  MINOR = 26
5
- PATCH = 1
5
+ PATCH = 3
6
6
  __version__ = f"{MAJOR}.{MINOR}.{PATCH}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cloudnetpy_qc
3
- Version: 1.26.1
3
+ Version: 1.26.3
4
4
  Summary: Quality control routines for CloudnetPy products
5
5
  Author-email: Finnish Meteorological Institute <actris-cloudnet@fmi.fi>
6
6
  License: MIT License
@@ -28,12 +28,12 @@ License: MIT License
28
28
  Project-URL: Homepage, https://github.com/actris-cloudnet/cloudnetpy-qc
29
29
  Project-URL: Repository, https://github.com/actris-cloudnet/cloudnetpy-qc
30
30
  Project-URL: Changelog, https://github.com/actris-cloudnet/cloudnetpy-qc/blob/main/CHANGELOG.md
31
+ Classifier: Development Status :: 5 - Production/Stable
31
32
  Classifier: Intended Audience :: Science/Research
32
33
  Classifier: License :: OSI Approved :: MIT License
33
34
  Classifier: Operating System :: OS Independent
34
- Classifier: Programming Language :: Python :: 3.10
35
- Classifier: Programming Language :: Python :: 3.11
36
- Classifier: Topic :: Scientific/Engineering
35
+ Classifier: Programming Language :: Python :: 3
36
+ Classifier: Topic :: Scientific/Engineering :: Atmospheric Science
37
37
  Requires-Python: >=3.10
38
38
  Description-Content-Type: text/markdown
39
39
  License-File: LICENSE
@@ -1,16 +1,16 @@
1
1
  cloudnetpy_qc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- cloudnetpy_qc/coverage.py,sha256=WeLiiGRYIjIvXo2QR7Z03WD_RPaV2D8d1R_oQiX68h8,2291
2
+ cloudnetpy_qc/coverage.py,sha256=s4ILSFHlD5-pHG9QiKE4leinUjWmLRib61QQ70Q1IJA,2305
3
3
  cloudnetpy_qc/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- cloudnetpy_qc/quality.py,sha256=Dbf4WOkMBmWAhq3vxriCRbPWQorAbZocX5bmT6trYc0,38820
4
+ cloudnetpy_qc/quality.py,sha256=QI0CzT4CWmaybX0GoN02yUuFrk25aHvIrHppvns9kxA,39590
5
5
  cloudnetpy_qc/utils.py,sha256=zFVryl56le2cyfDSCyGCzMHACcsjK7AJZknii1fgfgg,5393
6
6
  cloudnetpy_qc/variables.py,sha256=GIbVYxPyN_X5d5HWR_eV1g6X_8GHCarRWz3nhWkpF3Q,51181
7
- cloudnetpy_qc/version.py,sha256=AtfDmYQBHVvPVMgeJwG5qlnWj9JG2RwtSEtu_vAatC8,102
7
+ cloudnetpy_qc/version.py,sha256=OBF3AiI0Zm1S3CSLltvH0JVU8JcLvuPln1S9E4TyaZc,102
8
8
  cloudnetpy_qc/data/area-type-table.xml,sha256=LQGp6rk8d-jZVjeFWPK_NjG2Kk1atvLlQXmV4UXggKI,17788
9
9
  cloudnetpy_qc/data/cf-standard-name-table.xml,sha256=MGqs7uPH62jVpiN6as3jc5gswQvywjJzU_jzHtQOArA,4455853
10
10
  cloudnetpy_qc/data/data_quality_config.ini,sha256=YEZQuaRCLMamLypsL7hx1aSixZTq5avpX6Xdey2wGP4,1243
11
11
  cloudnetpy_qc/data/standardized-region-list.xml,sha256=gLRE2G7RQLD9hmvW5dTzyK7XPhORxWv2bfbrvAp5Uto,6426
12
- cloudnetpy_qc-1.26.1.dist-info/licenses/LICENSE,sha256=P0wszB7Cq2M390SKaqT4DGvECfwGOMdTTdxsWBpEUUc,1094
13
- cloudnetpy_qc-1.26.1.dist-info/METADATA,sha256=zaw5Vy6r0ledr31v07UDb3_bC_I--XVnGmChJbwuwKg,8315
14
- cloudnetpy_qc-1.26.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
15
- cloudnetpy_qc-1.26.1.dist-info/top_level.txt,sha256=shrf8A1KyrrnhbHocc4gHmTl38YY-DHflgf-gXiKnKs,14
16
- cloudnetpy_qc-1.26.1.dist-info/RECORD,,
12
+ cloudnetpy_qc-1.26.3.dist-info/licenses/LICENSE,sha256=P0wszB7Cq2M390SKaqT4DGvECfwGOMdTTdxsWBpEUUc,1094
13
+ cloudnetpy_qc-1.26.3.dist-info/METADATA,sha256=cVc_WVaqzVJxjjYrvSFcubDUus3Y5u07-ikuFU03bBA,8340
14
+ cloudnetpy_qc-1.26.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
15
+ cloudnetpy_qc-1.26.3.dist-info/top_level.txt,sha256=shrf8A1KyrrnhbHocc4gHmTl38YY-DHflgf-gXiKnKs,14
16
+ cloudnetpy_qc-1.26.3.dist-info/RECORD,,