diff --git a/gpm_api/accessor/__init__.py b/gpm_api/accessor/__init__.py index 9493ada9..49172475 100644 --- a/gpm_api/accessor/__init__.py +++ b/gpm_api/accessor/__init__.py @@ -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"] \ No newline at end of file +__all__ = ["GPM_Dataset_Accessor", "GPM_DataArray_Accessor"] diff --git a/gpm_api/dataset/crs.py b/gpm_api/dataset/crs.py index b54a5071..286862a3 100644 --- a/gpm_api/dataset/crs.py +++ b/gpm_api/dataset/crs.py @@ -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) diff --git a/gpm_api/dataset/reader.py b/gpm_api/dataset/reader.py index 5087d830..8237bf7f 100644 --- a/gpm_api/dataset/reader.py +++ b/gpm_api/dataset/reader.py @@ -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) diff --git a/gpm_api/io/checks.py b/gpm_api/io/checks.py index 30021588..598945f6 100644 --- a/gpm_api/io/checks.py +++ b/gpm_api/io/checks.py @@ -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() diff --git a/gpm_api/io/directories.py b/gpm_api/io/directories.py index b592252a..6491c686 100644 --- a/gpm_api/io/directories.py +++ b/gpm_api/io/directories.py @@ -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" diff --git a/gpm_api/io/download.py b/gpm_api/io/download.py index 2182ee9f..530ad31e 100644 --- a/gpm_api/io/download.py +++ b/gpm_api/io/download.py @@ -44,6 +44,7 @@ # - credientials: <...> # --> "--header='Authorization: Basic Z2lvbmF0YS5naGlnZ2lAZXBmbC5jaDpnaW9uYXRhLmdoaWdnaUBlcGZsLmNo' " + ##----------------------------------------------------------------------------. ############################# #### Single file command #### @@ -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) diff --git a/gpm_api/io/info.py b/gpm_api/io/info.py index 22fdefdc..6cee3494 100644 --- a/gpm_api/io/info.py +++ b/gpm_api/io/info.py @@ -30,7 +30,6 @@ def _parse_GPM_fname(fname): - # Retrieve information from filename p = Parser(NASA_FNAME_PATTERN) info_dict = p.parse(fname) diff --git a/gpm_api/io/patterns.py b/gpm_api/io/patterns.py index d3a552c2..e8dd8e45 100644 --- a/gpm_api/io/patterns.py +++ b/gpm_api/io/patterns.py @@ -4,6 +4,8 @@ @author: ghiggi """ + + # ----------------------------------------------------------------------------. ################################# ### File Pattern dictionary #### diff --git a/gpm_api/io/scan_modes.py b/gpm_api/io/scan_modes.py index 399ad22c..52ecdea1 100644 --- a/gpm_api/io/scan_modes.py +++ b/gpm_api/io/scan_modes.py @@ -12,7 +12,6 @@ def available_scan_modes(product, version): - ##---------------------------------------------. #### TRMM Radar if product in ["1B-PR"]: diff --git a/gpm_api/overpass/TODO_GPM_OVERPASS.py b/gpm_api/overpass/TODO_GPM_OVERPASS.py index 2ada6ca8..60faaf99 100644 --- a/gpm_api/overpass/TODO_GPM_OVERPASS.py +++ b/gpm_api/overpass/TODO_GPM_OVERPASS.py @@ -44,6 +44,7 @@ n_threads=10, ) + ####--------------------------------------------------------------------------. #### Compute overpass tables def generate_chunk_slices(chunks, shape): diff --git a/gpm_api/overpass/TODO_OVERPASS_STATS.py b/gpm_api/overpass/TODO_OVERPASS_STATS.py index 28d51545..168fb2ed 100644 --- a/gpm_api/overpass/TODO_OVERPASS_STATS.py +++ b/gpm_api/overpass/TODO_OVERPASS_STATS.py @@ -30,6 +30,7 @@ products = GPM_PMW_2A_GPROF_RS_products() product_type = "RS" + ####--------------------------------------------------------------------------. #### Define statistics to compute def _overpass_stats(df): diff --git a/gpm_api/patch/labels.py b/gpm_api/patch/labels.py index 5b1f8136..f2237f6b 100644 --- a/gpm_api/patch/labels.py +++ b/gpm_api/patch/labels.py @@ -25,6 +25,7 @@ # Note # - label_xarray_object available as ds.gpm_api.label_object + ####--------------------------------------------------------------------------. ##################### #### Area labels #### diff --git a/gpm_api/patch/labels_patch.py b/gpm_api/patch/labels_patch.py index 8cf3ccc8..6964c53a 100644 --- a/gpm_api/patch/labels_patch.py +++ b/gpm_api/patch/labels_patch.py @@ -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) diff --git a/gpm_api/patch/utils.py b/gpm_api/patch/utils.py index 17a9d058..97a0e3f6 100644 --- a/gpm_api/patch/utils.py +++ b/gpm_api/patch/utils.py @@ -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): diff --git a/gpm_api/scripts/download_daily_gpm_data.py b/gpm_api/scripts/download_daily_gpm_data.py index 66b91f6b..52baa4b1 100644 --- a/gpm_api/scripts/download_daily_gpm_data.py +++ b/gpm_api/scripts/download_daily_gpm_data.py @@ -14,6 +14,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_monthly_gpm_data.py b/gpm_api/scripts/download_monthly_gpm_data.py index 5cc5beab..7d0623ac 100644 --- a/gpm_api/scripts/download_monthly_gpm_data.py +++ b/gpm_api/scripts/download_monthly_gpm_data.py @@ -14,6 +14,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/utils/utils_HDF5.py b/gpm_api/utils/utils_HDF5.py index 1719d181..9596bb27 100644 --- a/gpm_api/utils/utils_HDF5.py +++ b/gpm_api/utils/utils_HDF5.py @@ -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 = [] diff --git a/gpm_api/visualization/OLD_comparison.py b/gpm_api/visualization/OLD_comparison.py index 19f3105b..0e1e8a3b 100644 --- a/gpm_api/visualization/OLD_comparison.py +++ b/gpm_api/visualization/OLD_comparison.py @@ -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 diff --git a/gpm_api/visualization/labels.py b/gpm_api/visualization/labels.py index d38dd493..81f002ab 100644 --- a/gpm_api/visualization/labels.py +++ b/gpm_api/visualization/labels.py @@ -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.") diff --git a/gpm_api/visualization/orbit.py b/gpm_api/visualization/orbit.py index 00ae917c..dcb24227 100644 --- a/gpm_api/visualization/orbit.py +++ b/gpm_api/visualization/orbit.py @@ -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) diff --git a/gpm_api/visualization/plot.py b/gpm_api/visualization/plot.py index a8b53e73..709340c7 100644 --- a/gpm_api/visualization/plot.py +++ b/gpm_api/visualization/plot.py @@ -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 @@ -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 diff --git a/tutorials/example_patches.py b/tutorials/example_patches.py index 091426f3..4645a9fc 100644 --- a/tutorials/example_patches.py +++ b/tutorials/example_patches.py @@ -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