Skip to content

Commit

Permalink
Use double quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
mraspaud committed Aug 30, 2024
1 parent 7de229d commit 38d4bb5
Show file tree
Hide file tree
Showing 23 changed files with 593 additions and 593 deletions.
34 changes: 17 additions & 17 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,33 @@

# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.todo',
'sphinx.ext.inheritance_diagram']
extensions = ["sphinx.ext.autodoc", "sphinx.ext.doctest", "sphinx.ext.todo",
"sphinx.ext.inheritance_diagram"]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# The suffix of source filenames.
source_suffix = '.rst'
source_suffix = ".rst"

# The encoding of source files.
#source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# General information about the project.
project = u'pygac'
copyright = u'2014, Abhay Devasthale, Martin Raspaud and Adam Dybbroe'
project = u"pygac"
copyright = u"2014, Abhay Devasthale, Martin Raspaud and Adam Dybbroe"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.1'
version = "0.1"
# The full version, including alpha/beta/rc tags.
release = '0.1'
release = "0.1"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down Expand Up @@ -81,7 +81,7 @@
#show_authors = False

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"

# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
Expand All @@ -91,7 +91,7 @@

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'default'
html_theme = "default"

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand Down Expand Up @@ -120,7 +120,7 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]

# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
Expand Down Expand Up @@ -164,7 +164,7 @@
#html_file_suffix = None

# Output file base name for HTML help builder.
htmlhelp_basename = 'pygacdoc'
htmlhelp_basename = "pygacdoc"


# -- Options for LaTeX output --------------------------------------------------
Expand All @@ -178,8 +178,8 @@
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'pygac.tex', u'pygac Documentation',
u'Abhay Devasthale, Martin Raspaud and Adam Dybbroe', 'manual'),
("index", "pygac.tex", u"pygac Documentation",
u"Abhay Devasthale, Martin Raspaud and Adam Dybbroe", "manual"),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -211,6 +211,6 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'pygac', u'pygac Documentation',
[u'Abhay Devasthale, Martin Raspaud and Adam Dybbroe'], 1)
("index", "pygac", u"pygac Documentation",
[u"Abhay Devasthale, Martin Raspaud and Adam Dybbroe"], 1)
]
2 changes: 1 addition & 1 deletion pygac/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@
# add a NullHandler to prevent messages in sys.stderr if the using application does
# not use logging, but pygac makes logging calls of severity WARNING and greater.
# See https://docs.python.org/3/howto/logging.html (Configuring Logging for a Library)
logging.getLogger('pygac').addHandler(logging.NullHandler())
logging.getLogger("pygac").addHandler(logging.NullHandler())
52 changes: 26 additions & 26 deletions pygac/calibration/noaa.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def calibrate(ds, custom_coeffs=None, coeffs_file=None):
jday = start_time.dayofyear.item()


corr = ds.attrs['sun_earth_distance_correction_factor']
corr = ds.attrs["sun_earth_distance_correction_factor"]

# how many reflective channels are there ?
tot_ref = channels.shape[2] - 3
Expand Down Expand Up @@ -106,9 +106,9 @@ def calibrate(ds, custom_coeffs=None, coeffs_file=None):

class CoeffStatus(Enum):
"""Indicates the status of calibration coefficients."""
NOMINAL = 'nominal'
PROVISIONAL = 'provisional'
EXPERIMENTAL = 'experimental'
NOMINAL = "nominal"
PROVISIONAL = "provisional"
EXPERIMENTAL = "experimental"


class Calibrator:
Expand All @@ -120,17 +120,17 @@ class Calibrator:
default_coeffs: dictonary containing default values for all spacecrafts
"""
version_hashs = {
'963af9b66268475ed500ad7b37da33c5': {
'name': 'PATMOS-x, v2017r1',
'status': CoeffStatus.NOMINAL
"963af9b66268475ed500ad7b37da33c5": {
"name": "PATMOS-x, v2017r1",
"status": CoeffStatus.NOMINAL
},
'689386c822de18a07194ac7fd71652ea': {
'name': 'PATMOS-x, v2017r1, with provisional coefficients for MetOp-C',
'status': CoeffStatus.PROVISIONAL
"689386c822de18a07194ac7fd71652ea": {
"name": "PATMOS-x, v2017r1, with provisional coefficients for MetOp-C",
"status": CoeffStatus.PROVISIONAL
},
'e8735ec394ecdb87b7edcd261e72d2eb': {
'name': 'PATMOS-x, v2023',
'status': CoeffStatus.PROVISIONAL
"e8735ec394ecdb87b7edcd261e72d2eb": {
"name": "PATMOS-x, v2023",
"status": CoeffStatus.PROVISIONAL
},
}
fields = [
Expand All @@ -139,7 +139,7 @@ class Calibrator:
"to_eff_blackbody_slope", "date_of_launch", "d", "spacecraft", "version"
]

Calibrator = namedtuple('Calibrator', fields)
Calibrator = namedtuple("Calibrator", fields)
default_coeffs = None
default_file = None
default_version = None
Expand Down Expand Up @@ -176,21 +176,21 @@ def __new__(cls, spacecraft, custom_coeffs=None, coeffs_file=None):
for key in ("dark_count", "gain_switch", "s0", "s1", "s2"):
arraycoeffs[key] = np.array([
coeffs[channel][key]
for channel in ('channel_1', 'channel_2', 'channel_3a')
for channel in ("channel_1", "channel_2", "channel_3a")
], dtype=float)
# thermal channels
for key in ("centroid_wavenumber", "space_radiance",
"to_eff_blackbody_intercept", "to_eff_blackbody_slope"):
arraycoeffs[key] = np.array([
coeffs[channel][key]
for channel in ('channel_3b', 'channel_4', 'channel_5')
for channel in ("channel_3b", "channel_4", "channel_5")
], dtype=float)
arraycoeffs["b"] = np.array([
[
coeffs[channel][key]
for key in ("b0", "b1", "b2")
]
for channel in ('channel_3b', 'channel_4', 'channel_5')
for channel in ("channel_3b", "channel_4", "channel_5")
], dtype=float)
# thermometers
# Note, that "thermometer_0" does not exists, and is filled with zeros to
Expand All @@ -203,7 +203,7 @@ def __new__(cls, spacecraft, custom_coeffs=None, coeffs_file=None):
for d in range(5)
], dtype=float)
# parse date of launch
date_of_launch_str = coeffs["date_of_launch"].replace('Z', '+00:00')
date_of_launch_str = coeffs["date_of_launch"].replace("Z", "+00:00")
if sys.version_info < (3, 7):
# Note that here any time information is lost
import dateutil.parser
Expand Down Expand Up @@ -238,7 +238,7 @@ def read_coeffs(cls, coeffs_file):
else:
LOG.debug("Read PyGAC internal calibration coefficients.")
coeffs_file = files("pygac") / "data/calibration.json"
with open(coeffs_file, mode='rb') as json_file:
with open(coeffs_file, mode="rb") as json_file:
content = json_file.read()
coeffs = json.loads(content)
version = cls._get_coeffs_version(content)
Expand All @@ -251,10 +251,10 @@ def _get_coeffs_version(cls, coeff_file_content):
digest = md5_hash.hexdigest()
version_dict = cls.version_hashs.get(

Check warning on line 252 in pygac/calibration/noaa.py

View check run for this annotation

codefactor.io / CodeFactor

pygac/calibration/noaa.py#L252

Use of insecure MD2, MD4, MD5, or SHA1 hash function. (B303)
digest,
{'name': None, 'status': None}
{"name": None, "status": None}
)
version = version_dict['name']
status = version_dict['status']
version = version_dict["name"]
status = version_dict["status"]
if version is None:
warning = "Unknown calibration coefficients version!"
warnings.warn(warning, RuntimeWarning)
Expand All @@ -263,7 +263,7 @@ def _get_coeffs_version(cls, coeff_file_content):
LOG.info('Identified calibration coefficients version "%s".',
version)
if status != CoeffStatus.NOMINAL:
warning = 'Using {} calibration coefficients'.format(status)
warning = "Using {} calibration coefficients".format(status)
warnings.warn(warning, RuntimeWarning)
LOG.warning(warning)
return version
Expand Down Expand Up @@ -535,9 +535,9 @@ def calibrate_thermal(counts, prt, ict, space, line_numbers, channel, cal):
wlength = 3

weighting_function = np.ones(wlength, dtype=float) / wlength
tprt_convolved = np.convolve(tprt, weighting_function, 'same')
ict_convolved = np.convolve(ict, weighting_function, 'same')
space_convolved = np.convolve(space, weighting_function, 'same')
tprt_convolved = np.convolve(tprt, weighting_function, "same")
ict_convolved = np.convolve(ict, weighting_function, "same")
space_convolved = np.convolve(space, weighting_function, "same")

# take care of the beginning and end
tprt_convolved[0:(wlength - 1) // 2] = tprt_convolved[(wlength - 1) // 2]
Expand Down
8 changes: 4 additions & 4 deletions pygac/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class FileNotFoundError(OSError):
class Configuration(configparser.ConfigParser, object):
"""Configuration container for pygac."""

config_file = ''
config_file = ""

def read(self, config_file):
"""Read and parse the configuration file
Expand All @@ -70,8 +70,8 @@ def read(self, config_file):
def get(self, *args, **kwargs):
"""python 2 compatibility for fallback attribute"""
if sys.version_info.major < 3:
if 'fallback' in kwargs:
fallback = kwargs.pop('fallback')
if "fallback" in kwargs:
fallback = kwargs.pop("fallback")
else:
fallback = None
try:
Expand Down Expand Up @@ -100,7 +100,7 @@ def get_config(initialized=True):
try:
config_file = os.environ["PYGAC_CONFIG_FILE"]
except KeyError:
LOG.error('Environment variable PYGAC_CONFIG_FILE not set!')
LOG.error("Environment variable PYGAC_CONFIG_FILE not set!")
raise
_config.read(config_file)
return _config
Expand Down
2 changes: 1 addition & 1 deletion pygac/correct_tsm_issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ def std_filter(data, box_size):
# need to surround the data with NaNs to calculate values at the boundary
padded_data = np.pad(
data, (border, border),
mode='constant',
mode="constant",
constant_values=np.nan
)
windows = _rolling_window(padded_data, size)
Expand Down
Loading

0 comments on commit 38d4bb5

Please sign in to comment.