Skip to content

Commit

Permalink
Merge pull request #735 from ssec/pre-commit-ci-update-config
Browse files Browse the repository at this point in the history
  • Loading branch information
djhoese authored Feb 4, 2025
2 parents 71d1dfe + 52d37f7 commit 44aaeee
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ exclude: '^$'
fail_fast: false
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.8.6'
rev: 'v0.9.4'
hooks:
- id: ruff
args: ["--fix"]
Expand Down
2 changes: 1 addition & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ def setup(app):
{title_underline}
:Grid Name: {area_name}
:Description: {area_dict['description']}
:Description: {area_dict["description"]}
:Projection: {crs.to_string()}
"""

Expand Down
18 changes: 8 additions & 10 deletions polar2grid/_glue_argparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def _add_common_arguments(parser: argparse.ArgumentParser, binary_name: str) ->
dest="verbosity",
action="count",
default=0,
help="each occurrence increases verbosity 1 level through " "ERROR-WARNING-INFO-DEBUG (default INFO)",
help="each occurrence increases verbosity 1 level through ERROR-WARNING-INFO-DEBUG (default INFO)",
)
parser.add_argument("-l", "--log", dest="log_fn", default=None, help="specify the log filename")
parser.add_argument(
Expand Down Expand Up @@ -288,22 +288,22 @@ def _validate_reader_writer_args(parser, args, use_polar2grid_defaults):
parser.print_usage()
parser.exit(
1,
"\nERROR: Reader must be provided (-r flag).\n" "Supported readers:\n\t{}\n".format(
"\nERROR: Reader must be provided (-r flag).\nSupported readers:\n\t{}\n".format(
"\n\t".join(_supported_readers(use_polar2grid_defaults))
),
)
elif len(args.readers) > 1:
parser.print_usage()
parser.exit(
1,
"\nMultiple readers is not currently supported. Got:\n\t" "{}\n".format("\n\t".join(args.readers)),
"\nMultiple readers is not currently supported. Got:\n\t{}\n".format("\n\t".join(args.readers)),
)
return -1
if args.writers is None:
parser.print_usage()
parser.exit(
1,
"\nERROR: Writer must be provided (-w flag) with one or more writer.\n" "Supported writers:\n\t{}\n".format(
"\nERROR: Writer must be provided (-w flag) with one or more writer.\nSupported writers:\n\t{}\n".format(
"\n\t".join(_supported_writers(use_polar2grid_defaults))
),
)
Expand Down Expand Up @@ -390,7 +390,7 @@ def add_scene_argument_groups(parser, is_polar2grid=False):
dest="readers",
metavar="READER",
type=_convert_reader_name,
help="Name of reader used to read provided files. " "Supported readers: " + ", ".join(readers),
help="Name of reader used to read provided files. Supported readers: " + ", ".join(readers),
)
group_1.add_argument(
"-f",
Expand Down Expand Up @@ -502,7 +502,7 @@ def add_writer_argument_groups(parser, is_polar2grid=False):
dest="writers",
type=_convert_writer_name,
metavar="WRITER",
help="Writer used to save datasets. " "Supported writers: " + ", ".join(writers),
help="Writer used to save datasets. Supported writers: " + ", ".join(writers),
# help="Writers to save datasets with. Multiple writers "
# "can be provided by specifying '-w' multiple "
# "times (ex. '-w geotiff -w awips_tiled'). "
Expand Down Expand Up @@ -608,7 +608,7 @@ def add_resample_argument_groups(parser, is_polar2grid=None):
"--grid-coverage",
default=0.1,
type=float,
help="Fraction of target grid that must contain " "data to continue processing product.",
help="Fraction of target grid that must contain data to continue processing product.",
)
group_1.add_argument(
"--cache-dir",
Expand All @@ -620,9 +620,7 @@ def add_resample_argument_groups(parser, is_polar2grid=None):
"--grid-configs",
nargs="+",
default=tuple(),
help="Specify additional grid configuration files. "
"(.conf for legacy CSV grids, .yaml for "
"SatPy-style areas)",
help="Specify additional grid configuration files. (.conf for legacy CSV grids, .yaml for SatPy-style areas)",
)
group_1.add_argument(
"--ll-bbox",
Expand Down
7 changes: 3 additions & 4 deletions polar2grid/add_coastlines.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ def _get_colorbar_vmin_vmax(arg_min, arg_max, metadata, input_dtype):
dtype_max = float(np.iinfo(input_dtype).max)
if arg_min is None and scale is None:
LOG.warning(
"Colorbar min/max metadata not found and not provided "
"on the command line. Defaulting to data type limits."
"Colorbar min/max metadata not found and not provided on the command line. Defaulting to data type limits."
)
return dtype_min, dtype_max

Expand Down Expand Up @@ -458,7 +457,7 @@ def _args_to_colorbar_kwargs(args):
if args.colorbar_width is None or args.colorbar_height is None:
if args.colorbar_width is not None or args.colorbar_height is not None:
LOG.warning(
"'--colorbar-width' and '--colorbar-height' were not both specified. " "Forcing '--colorbar-extend'."
"'--colorbar-width' and '--colorbar-height' were not both specified. Forcing '--colorbar-extend'."
)
args.colorbar_extend = True

Expand Down Expand Up @@ -531,7 +530,7 @@ def _get_colormap_object(input_tiff, num_bands, cmin, cmax):
metadata = rio_ds.tags()
cmap = _convert_table_to_cmap_or_default_bw(input_dtype, rio_ct, num_bands)
if num_bands in (3, 4) and colormap_csv is None:
raise ValueError("RGB and RGBA geotiffs must have a colormap " "specified with '--colorbar-colormap-file'.")
raise ValueError("RGB and RGBA geotiffs must have a colormap specified with '--colorbar-colormap-file'.")
if num_bands in (3, 4) or colormap_csv is not None:
cmap = Colormap.from_string(colormap_csv)
vmin, vmax = _get_colorbar_vmin_vmax(cmin, cmax, metadata, input_dtype)
Expand Down
3 changes: 1 addition & 2 deletions polar2grid/readers/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ def get_available_products(
p2g_product_names = self.get_all_products()
if not p2g_product_names:
logger.warning(
"Provided readers are not configured in %s. All "
"products will be listed with internal Satpy names.",
"Provided readers are not configured in %s. All products will be listed with internal Satpy names.",
self._binary_name,
)
return sorted(set([x["name"] for x in possible_satpy_ids])), [], []
Expand Down
4 changes: 2 additions & 2 deletions polar2grid/readers/modis_l1b.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,14 +277,14 @@ def add_reader_argument_groups(
dest="products",
action=ExtendConstAction,
const=_AWIPS_TRUE_COLOR,
help="Add individual CREFL corrected products to create " "the 'true_color' composite in AWIPS.",
help="Add individual CREFL corrected products to create the 'true_color' composite in AWIPS.",
)
group.add_argument(
"--awips-false-color",
dest="products",
action=ExtendConstAction,
const=_AWIPS_FALSE_COLOR,
help="Add individual CREFL corrected products to create " "the 'false_color' composite in AWIPS.",
help="Add individual CREFL corrected products to create the 'false_color' composite in AWIPS.",
)
group.add_argument(
"--mask-saturated",
Expand Down
2 changes: 1 addition & 1 deletion polar2grid/writers/geotiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def add_writer_argument_groups(parser, group=None):
"--dtype",
choices=NumpyDtypeList(NUMPY_DTYPE_STRS),
type=str_to_dtype,
help="Data type of the output file (8-bit unsigned " "integer by default - uint8)",
help="Data type of the output file (8-bit unsigned integer by default - uint8)",
)
group.add_argument(
"--no-enhance",
Expand Down
6 changes: 3 additions & 3 deletions polar2grid/writers/hdf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def write_geolocation(
self, fh, fname: str, parent: str, area_def, dtype: np.dtype, append: bool, compression, chunks: tuple[int, int]
) -> tuple[list, list[FakeHDF5]]:
"""Delayed Geolocation Data write."""
msg = ("Adding geolocation 'longitude' and " "'latitude' datasets for grid %s", parent)
msg = ("Adding geolocation 'longitude' and 'latitude' datasets for grid %s", parent)
LOG.info(msg)
lon_data, lat_data = area_def.get_lonlats(chunks=chunks)

Expand Down Expand Up @@ -216,7 +216,7 @@ def create_variable(hdf_fh, hdf_subgroup: str, data_arr: xr.DataArray, dtype: np
d_dtype = data_arr.dtype if dtype is None else dtype

if hdf_subgroup in hdf_fh:
LOG.warning("Product %s already in HDF5 group," "will delete existing dataset", hdf_subgroup)
LOG.warning("Product %s already in HDF5 group,will delete existing dataset", hdf_subgroup)
del hdf_fh[hdf_subgroup]

dset = hdf_fh.create_dataset(hdf_subgroup, shape=data_arr.shape, dtype=d_dtype, compression=compression)
Expand Down Expand Up @@ -252,7 +252,7 @@ def save_datasets(

filename = output_names[0]
if not all_equal(output_names):
LOG.warning("More than one output filename possible. " "Writing to only '{}'.".format(filename))
LOG.warning("More than one output filename possible. Writing to only '{}'.".format(filename))

HDF5_fh = self.open_HDF5_filehandle(filename, append=append)

Expand Down

0 comments on commit 44aaeee

Please sign in to comment.