From 7546353884830b9da2c8c195f4ab1794621ca7ce Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 16 Oct 2023 21:08:23 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.4.0 → v4.5.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.4.0...v4.5.0) - https://github.com/charliermarsh/ruff-pre-commit → https://github.com/astral-sh/ruff-pre-commit - [github.com/astral-sh/ruff-pre-commit: v0.0.257 → v0.1.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.257...v0.1.0) - [github.com/psf/black: 22.8.0 → 23.9.1](https://github.com/psf/black/compare/22.8.0...23.9.1) - [github.com/codespell-project/codespell: v2.2.4 → v2.2.6](https://github.com/codespell-project/codespell/compare/v2.2.4...v2.2.6) --- .pre-commit-config.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 69ca76bb..4cf27bb5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,18 +1,18 @@ 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 - - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.257 + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.1.0 hooks: - id: ruff args: [--fix] - repo: https://github.com/psf/black - rev: 22.8.0 + rev: 23.9.1 hooks: - id: black language_version: python3 @@ -24,7 +24,7 @@ repos: additional_dependencies: ["black[jupyter]"] - repo: https://github.com/codespell-project/codespell - rev: v2.2.4 + rev: v2.2.6 hooks: - id: codespell types_or: [python, markdown] From c80563dceda92cdd099230bbde41d994a362ce9f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 16 Oct 2023 21:08:37 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- gpm_api/bucket/analysis.py | 1 - gpm_api/bucket/writers.py | 3 ++- gpm_api/dataset/crs.py | 1 - gpm_api/old_dataset/reader.py | 1 - gpm_api/scripts/download_gpm_daily_data.py | 1 + gpm_api/scripts/download_gpm_files.py | 1 + gpm_api/scripts/download_gpm_monthly_data.py | 1 + gpm_api/tests/0_tmp/dataset/0_create_test_files.py | 1 - gpm_api/utils/utils_HDF5.py | 1 + gpm_api/visualization/orbit.py | 1 - gpm_api/visualization/plot.py | 1 - gpm_api/visualization/profile.py | 1 - 12 files changed, 6 insertions(+), 8 deletions(-) diff --git a/gpm_api/bucket/analysis.py b/gpm_api/bucket/analysis.py index 29739a70..eb85b24e 100644 --- a/gpm_api/bucket/analysis.py +++ b/gpm_api/bucket/analysis.py @@ -80,7 +80,6 @@ def get_cut_lon_breaks_labels(bin_spacing): def pl_add_geographic_bins( df, xbin_column, ybin_column, bin_spacing, x_column="lon", y_column="lat" ): - cut_lon_breaks, cut_lon_labels = get_cut_lon_breaks_labels(bin_spacing) cut_lat_breaks, cut_lat_labels = get_cut_lat_breaks_labels(bin_spacing) df = df.with_columns( diff --git a/gpm_api/bucket/writers.py b/gpm_api/bucket/writers.py index 837f3c33..bbba6fa4 100644 --- a/gpm_api/bucket/writers.py +++ b/gpm_api/bucket/writers.py @@ -235,6 +235,7 @@ def write_granules_bucket( ####--------------------------------------------------------------------------. #### Single GPM Granule Routines OLD + # TODO: Currently used for final merging # --> Adapt code to use write_partitioned_dataset def write_parquet_dataset( @@ -477,6 +478,7 @@ def name_function(i): # return None + ####--------------------------------------------------------------------------. #### GPM Datasets Routines @print_task_elapsed_time(prefix="Dataset Bucket Operation Terminated.") @@ -498,7 +500,6 @@ def write_dataset_bucket( use_threads=True, **writer_kwargs, ): - df = convert_ds_to_df( ds=ds, preprocessing_function=preprocessing_function, diff --git a/gpm_api/dataset/crs.py b/gpm_api/dataset/crs.py index 30c72a51..027d70e1 100644 --- a/gpm_api/dataset/crs.py +++ b/gpm_api/dataset/crs.py @@ -317,7 +317,6 @@ def _add_proj_coords_attrs(ds, crs) -> xr.Dataset: # If available, add attributes if x_dim is not None and y_dim is not None: - # Retrieve existing coordinate attributes src_x_coord_attrs = dict(ds[x_dim].attrs) src_y_coord_attrs = dict(ds[y_dim].attrs) diff --git a/gpm_api/old_dataset/reader.py b/gpm_api/old_dataset/reader.py index 07ce256b..0c52ea7f 100644 --- a/gpm_api/old_dataset/reader.py +++ b/gpm_api/old_dataset/reader.py @@ -144,7 +144,6 @@ def _get_granule_info(filepath, scan_mode, variables, groups): """Retrieve coordinates, attributes and valid variables and groups from the HDF file.""" # Open HDF5 file with h5py.File(filepath, "r", locking=False, swmr=SWMR) as hdf: - # Get coordinates coords = get_coords(hdf, scan_mode) diff --git a/gpm_api/scripts/download_gpm_daily_data.py b/gpm_api/scripts/download_gpm_daily_data.py index 1c66822a..202d98b0 100644 --- a/gpm_api/scripts/download_gpm_daily_data.py +++ b/gpm_api/scripts/download_gpm_daily_data.py @@ -12,6 +12,7 @@ warnings.filterwarnings("ignore") sys.tracebacklimit = 0 # avoid full traceback error if occur + # -------------------------------------------------------------------------. # Click Command Line Interface decorator @click.command() diff --git a/gpm_api/scripts/download_gpm_files.py b/gpm_api/scripts/download_gpm_files.py index eff74bdb..905c54db 100644 --- a/gpm_api/scripts/download_gpm_files.py +++ b/gpm_api/scripts/download_gpm_files.py @@ -12,6 +12,7 @@ warnings.filterwarnings("ignore") sys.tracebacklimit = 0 # avoid full traceback error if occur + # -------------------------------------------------------------------------. # Click Command Line Interface decorator @click.command() diff --git a/gpm_api/scripts/download_gpm_monthly_data.py b/gpm_api/scripts/download_gpm_monthly_data.py index e87d3a37..295359c8 100644 --- a/gpm_api/scripts/download_gpm_monthly_data.py +++ b/gpm_api/scripts/download_gpm_monthly_data.py @@ -12,6 +12,7 @@ warnings.filterwarnings("ignore") sys.tracebacklimit = 0 # avoid full traceback error if occur + # -------------------------------------------------------------------------. # Click Command Line Interface decorator @click.command() diff --git a/gpm_api/tests/0_tmp/dataset/0_create_test_files.py b/gpm_api/tests/0_tmp/dataset/0_create_test_files.py index 9483a90b..f5ea2bfa 100644 --- a/gpm_api/tests/0_tmp/dataset/0_create_test_files.py +++ b/gpm_api/tests/0_tmp/dataset/0_create_test_files.py @@ -86,7 +86,6 @@ def _copy_attrs(src_h5_obj, dst_h5_obj): def _copy_datasets(src_group, dst_group, subset_size=5): for name, h5_obj in src_group.items(): if isinstance(h5_obj, h5py.Dataset): - # Determine the subset shape (2 indices per dimension) subset_shape, subset_chunks = _get_subset_shape_chunks(h5_obj, subset_size=subset_size) diff --git a/gpm_api/utils/utils_HDF5.py b/gpm_api/utils/utils_HDF5.py index cb0da16e..5de8fffa 100644 --- a/gpm_api/utils/utils_HDF5.py +++ b/gpm_api/utils/utils_HDF5.py @@ -221,6 +221,7 @@ def h5dump(filepath, group="/", dataset_attrs=True, group_attrs=True): # for item in x.keys(): # print_hdf5_shape(x[item]) + # -----------------------------------------------------------------------------. def hdf5_objects_names(hdf): l_objs = [] diff --git a/gpm_api/visualization/orbit.py b/gpm_api/visualization/orbit.py index 58ea2e85..de7994bd 100644 --- a/gpm_api/visualization/orbit.py +++ b/gpm_api/visualization/orbit.py @@ -202,7 +202,6 @@ def wrapper(*args, **kwargs): # - Call the function over each slice for i, slc in enumerate(list_slices): - if not rgb: # Retrieve contiguous data array tmp_da = da.isel({"along_track": slc}) diff --git a/gpm_api/visualization/plot.py b/gpm_api/visualization/plot.py index 1e9567e0..99f46f3e 100644 --- a/gpm_api/visualization/plot.py +++ b/gpm_api/visualization/plot.py @@ -573,7 +573,6 @@ def plot_map( cbar_kwargs={}, **plot_kwargs, ): - from gpm_api.checks import is_grid, is_orbit from gpm_api.visualization.grid import plot_grid_map from gpm_api.visualization.orbit import plot_orbit_map diff --git a/gpm_api/visualization/profile.py b/gpm_api/visualization/profile.py index 8395c794..cc6bb829 100644 --- a/gpm_api/visualization/profile.py +++ b/gpm_api/visualization/profile.py @@ -218,7 +218,6 @@ def select_transect( transect_kwargs={}, keep_only_valid_variables=True, ): - # Identify transect isel_dict transect_slices = get_transect_slices( xr_obj,