From e7b7a39230b6c8be31c5cdd2a29a81171c62c30e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20M=C3=BChlbauer?= Date: Thu, 22 Feb 2024 13:34:49 +0100 Subject: [PATCH] MNT: address black style changes, update pre-commit-config.yaml (#152) --- .pre-commit-config.yaml | 10 +++++----- xradar/georeference/projection.py | 4 +--- xradar/io/backends/furuno.py | 6 +++--- xradar/io/backends/iris.py | 6 +++--- xradar/io/backends/odim.py | 6 +++--- xradar/io/backends/rainbow.py | 6 +++--- xradar/io/export/cfradial1.py | 8 +++++--- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 949600f3..d422276d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer @@ -10,23 +10,23 @@ repos: - id: debug-statements - id: mixed-line-ending - repo: https://github.com/asottile/pyupgrade - rev: v3.3.1 + rev: v3.15.1 hooks: - id: pyupgrade args: - '--py38-plus' - repo: https://github.com/kynan/nbstripout - rev: 0.6.1 + rev: 0.7.1 hooks: - id: nbstripout args: ['--extra-keys', 'metadata.kernelspec cell.metadata.pycharm cell.metadata.tags'] - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: 'v0.0.246' + rev: 'v0.2.2' hooks: - id: ruff args: ['--fix'] - repo: https://github.com/psf/black - rev: 23.1.0 + rev: 24.2.0 hooks: - id: black - id: black-jupyter diff --git a/xradar/georeference/projection.py b/xradar/georeference/projection.py index b8a73ad3..532fc38c 100644 --- a/xradar/georeference/projection.py +++ b/xradar/georeference/projection.py @@ -73,9 +73,7 @@ def get_crs(ds, datum="WGS84"): crs_wkt = ( ds["crs_wkt"] if "crs_wkt" in ds - else ds["spatial_ref"] - if "spatial_ref" in ds - else False + else ds["spatial_ref"] if "spatial_ref" in ds else False ) if crs_wkt is not False: proj_crs = pyproj.CRS.from_cf(crs_wkt.attrs) diff --git a/xradar/io/backends/furuno.py b/xradar/io/backends/furuno.py index afff3b53..eea27299 100644 --- a/xradar/io/backends/furuno.py +++ b/xradar/io/backends/furuno.py @@ -602,9 +602,9 @@ def open_store_variable(self, name, var): attrs["scale_factor"] = scale_factor attrs["_FillValue"] = 0.0 dims = (dim, "range") - attrs[ - "coordinates" - ] = "elevation azimuth range latitude longitude altitude time" + attrs["coordinates"] = ( + "elevation azimuth range latitude longitude altitude time" + ) return Variable(dims, data, attrs, encoding) def open_store_coordinates(self): diff --git a/xradar/io/backends/iris.py b/xradar/io/backends/iris.py index 97d0ee1a..18701416 100644 --- a/xradar/io/backends/iris.py +++ b/xradar/io/backends/iris.py @@ -3834,9 +3834,9 @@ def open_store_variable(self, name, var): mname = iris_mapping.get(name, name) mapping = sweep_vars_mapping.get(mname, {}) attrs = {key: mapping[key] for key in moment_attrs if key in mapping} - attrs[ - "coordinates" - ] = "elevation azimuth range latitude longitude altitude time" + attrs["coordinates"] = ( + "elevation azimuth range latitude longitude altitude time" + ) return mname, Variable((dim, "range"), data, attrs, encoding) def open_store_coordinates(self, var): diff --git a/xradar/io/backends/odim.py b/xradar/io/backends/odim.py index 1035b878..4aee848c 100644 --- a/xradar/io/backends/odim.py +++ b/xradar/io/backends/odim.py @@ -482,9 +482,9 @@ def _get_odim_variable_name_and_attrs(name, attrs): pass else: attrs.update({key: mapping[key] for key in moment_attrs}) - attrs[ - "coordinates" - ] = "elevation azimuth range latitude longitude altitude time" + attrs["coordinates"] = ( + "elevation azimuth range latitude longitude altitude time" + ) return name, attrs diff --git a/xradar/io/backends/rainbow.py b/xradar/io/backends/rainbow.py index d8d18cc8..7e3cb993 100644 --- a/xradar/io/backends/rainbow.py +++ b/xradar/io/backends/rainbow.py @@ -638,9 +638,9 @@ def open_store_variable(self, var): attrs["add_offset"] = vmin - scale_factor attrs["scale_factor"] = scale_factor attrs["_FillValue"] = 0 - attrs[ - "coordinates" - ] = "elevation azimuth range latitude longitude altitude time" + attrs["coordinates"] = ( + "elevation azimuth range latitude longitude altitude time" + ) return {mname: Variable((dim, "range"), data, attrs, encoding)} def open_store_coordinates(self, var): diff --git a/xradar/io/export/cfradial1.py b/xradar/io/export/cfradial1.py index 400d844b..29f23a2f 100644 --- a/xradar/io/export/cfradial1.py +++ b/xradar/io/export/cfradial1.py @@ -189,9 +189,11 @@ def _sweep_info_mapper(dtree): for var_name in sweep_vars: var_data_list = [ - np.unique(dtree[s][var_name].values[np.newaxis, ...]) - if var_name in dtree[s] - else np.array([np.nan]) + ( + np.unique(dtree[s][var_name].values[np.newaxis, ...]) + if var_name in dtree[s] + else np.array([np.nan]) + ) for s in dtree.groups if "sweep" in s ]