Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jun 13, 2023
1 parent 5a8b3f6 commit 0d1a0ee
Show file tree
Hide file tree
Showing 22 changed files with 17 additions and 18 deletions.
4 changes: 2 additions & 2 deletions gpm_api/accessor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
@author: ghiggi
"""
from .methods import GPM_Dataset_Accessor, GPM_DataArray_Accessor
from .methods import GPM_DataArray_Accessor, GPM_Dataset_Accessor

__all__ = ["GPM_Dataset_Accessor", "GPM_DataArray_Accessor"]
__all__ = ["GPM_Dataset_Accessor", "GPM_DataArray_Accessor"]
1 change: 0 additions & 1 deletion gpm_api/dataset/crs.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,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)
Expand Down
1 change: 0 additions & 1 deletion gpm_api/dataset/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,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)

Expand Down
6 changes: 3 additions & 3 deletions gpm_api/io/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ def check_time(time):
if np.issubdtype(time.dtype, np.datetime64):
if time.size == 1:
time = time.astype("datetime64[s]").tolist()
else:
else:
raise ValueError("Expecting a single timestep!")
else:
else:
raise ValueError("The numpy array does not have a np.datetime64 dtype!")

# If np.datetime64, convert to datetime.datetime
if isinstance(time, np.datetime64):
time = time.astype("datetime64[s]").tolist()
Expand Down
1 change: 0 additions & 1 deletion gpm_api/io/directories.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,6 @@ def get_pps_directory(product, product_type, date, version):
##------------------------------------------------------------------------.
#### RS data
elif product_type == "RS":

## Specify servers
url_server_text = "https://arthurhouhttps.pps.eosdis.nasa.gov/text"
url_data_server = "ftps://arthurhouftps.pps.eosdis.nasa.gov"
Expand Down
2 changes: 1 addition & 1 deletion gpm_api/io/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
# - credientials: <...>
# --> "--header='Authorization: Basic Z2lvbmF0YS5naGlnZ2lAZXBmbC5jaDpnaW9uYXRhLmdoaWdnaUBlcGZsLmNo' "


##----------------------------------------------------------------------------.
#############################
#### Single file command ####
Expand Down Expand Up @@ -276,7 +277,6 @@ def _download_files(
progress_bar=True,
verbose=False,
):

if transfer_tool == "curl":
list_cmd = [
curl_cmd(src_path, dst_path, username, username)
Expand Down
1 change: 0 additions & 1 deletion gpm_api/io/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@


def _parse_GPM_fname(fname):

# Retrieve information from filename
p = Parser(NASA_FNAME_PATTERN)
info_dict = p.parse(fname)
Expand Down
2 changes: 2 additions & 0 deletions gpm_api/io/patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
@author: ghiggi
"""


# ----------------------------------------------------------------------------.
#################################
### File Pattern dictionary ####
Expand Down
1 change: 0 additions & 1 deletion gpm_api/io/scan_modes.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@


def available_scan_modes(product, version):

##---------------------------------------------.
#### TRMM Radar
if product in ["1B-PR"]:
Expand Down
1 change: 1 addition & 0 deletions gpm_api/overpass/TODO_GPM_OVERPASS.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
n_threads=10,
)


####--------------------------------------------------------------------------.
#### Compute overpass tables
def generate_chunk_slices(chunks, shape):
Expand Down
1 change: 1 addition & 0 deletions gpm_api/overpass/TODO_OVERPASS_STATS.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
products = GPM_PMW_2A_GPROF_RS_products()
product_type = "RS"


####--------------------------------------------------------------------------.
#### Define statistics to compute
def _overpass_stats(df):
Expand Down
1 change: 1 addition & 0 deletions gpm_api/patch/labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
# Note
# - label_xarray_object available as ds.gpm_api.label_object


####--------------------------------------------------------------------------.
#####################
#### Area labels ####
Expand Down
1 change: 0 additions & 1 deletion gpm_api/patch/labels_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ def get_labeled_object_patches(

# Extract patch around the label
for label_id in labels_id[0:n_patches]:

# Get label bounding box slices
list_slices = _get_labels_bbox_slices(label_arr == label_id)

Expand Down
1 change: 1 addition & 0 deletions gpm_api/patch/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def split_large_objects_slices(objects_slices, patch_size):
#### Patch Extraction ####
##########################


# get_patch_slices_around_point
def get_patch_slices_around(row, col, patch_size, image_shape):
if len(patch_size) != len(image_shape):
Expand Down
1 change: 1 addition & 0 deletions gpm_api/scripts/download_daily_gpm_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
warnings.filterwarnings("ignore")
sys.tracebacklimit = 0 # avoid full traceback error if occur


# -------------------------------------------------------------------------.
# Click Command Line Interface decorator
@click.command()
Expand Down
1 change: 1 addition & 0 deletions gpm_api/scripts/download_monthly_gpm_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
warnings.filterwarnings("ignore")
sys.tracebacklimit = 0 # avoid full traceback error if occur


# -------------------------------------------------------------------------.
# Click Command Line Interface decorator
@click.command()
Expand Down
1 change: 1 addition & 0 deletions gpm_api/utils/utils_HDF5.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,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 = []
Expand Down
1 change: 0 additions & 1 deletion gpm_api/visualization/OLD_comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ def compare_products(
version=7,
product_type="RS",
):

#### Preprocess bbox
# - Enlarge so to be sure to include all data when cropping
# TODO: Robustify to deal when close to the antimeridian
Expand Down
1 change: 0 additions & 1 deletion gpm_api/visualization/labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ def plot_label_patches(
fig_kwargs={},
**plot_kwargs,
):

# Check plot_kwargs keys
if "cbar_kwargs" in plot_kwargs:
raise ValueError("'cbar_kwargs' can not be specified when plotting labels.")
Expand Down
1 change: 0 additions & 1 deletion gpm_api/visualization/orbit.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ def wrapper(*args, **kwargs):

# - Call the function over each slice
for i, slc in enumerate(list_slices):

# Retrive contiguous data array
tmp_da = da.isel(along_track=slc)

Expand Down
3 changes: 0 additions & 3 deletions gpm_api/visualization/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@
"""
import cartopy
import cartopy.crs as ccrs
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.collections import PolyCollection
from mpl_toolkits.axes_grid1 import make_axes_locatable
from scipy.ndimage import binary_dilation


### TODO: Add xarray + cartopy (xr_carto) (xr_mpl)
# _plot_cartopy_xr_imshow
# _plot_cartopy_xr_pcolormesh
Expand Down Expand Up @@ -330,7 +328,6 @@ def plot_map(
cbar_kwargs={},
**plot_kwargs,
):

from gpm_api.utils.geospatial import is_grid, is_orbit

from .grid import plot_grid_map
Expand Down
2 changes: 2 additions & 0 deletions tutorials/example_patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
@author: ghiggi
"""
import datetime

import numpy as np

import gpm_api
from gpm_api.patch.labels import xr_get_areas_labels

Expand Down

0 comments on commit 0d1a0ee

Please sign in to comment.