Skip to content

Commit

Permalink
Merge pull request #193 from zmoon/upc
Browse files Browse the repository at this point in the history
Update pre-commit hooks
  • Loading branch information
zmoon authored Sep 19, 2024
2 parents db64a0e + a0767e9 commit 56eef95
Show file tree
Hide file tree
Showing 24 changed files with 46 additions and 29 deletions.
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v4.4.0"
rev: "v4.6.0"
hooks:
- id: trailing-whitespace
exclude: tdump\.[0-9]*
Expand All @@ -9,23 +9,23 @@ repos:
- id: check-yaml

- repo: https://github.com/asottile/pyupgrade
rev: "v3.3.1"
rev: "v3.17.0"
hooks:
- id: pyupgrade
args: [--py36-plus]

- repo: https://github.com/PyCQA/isort
rev: "5.12.0"
rev: "5.13.2"
hooks:
- id: isort

- repo: https://github.com/psf/black
rev: "23.1.0"
rev: "24.8.0"
hooks:
- id: black

- repo: https://github.com/PyCQA/flake8
rev: "6.0.0"
rev: "7.1.1"
hooks:
- id: flake8

Expand Down
1 change: 1 addition & 0 deletions monetio/models/_cesm_se_mm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" CESM File Reader """

import xarray as xr


Expand Down
1 change: 1 addition & 0 deletions monetio/models/_cmaq_mm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" CMAQ File Reader """

import xarray as xr
from numpy import array, concatenate
from pandas import Series, to_datetime
Expand Down
1 change: 1 addition & 0 deletions monetio/models/_rrfs_cmaq_mm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" RRFS-CMAQ File Reader """

import numpy as np
import xarray as xr
from numpy import concatenate
Expand Down
1 change: 1 addition & 0 deletions monetio/models/_wrfchem_mm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" WRF-Chem File reader """

import xarray as xr
from pandas import Series

Expand Down
1 change: 1 addition & 0 deletions monetio/models/camx.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" CAMx File Reader """

import xarray as xr
from numpy import array, concatenate
from pandas import Series, to_datetime
Expand Down
1 change: 1 addition & 0 deletions monetio/models/cmaq.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" CMAQ File Reader """

import xarray as xr
from numpy import array, concatenate
from pandas import Series, to_datetime
Expand Down
1 change: 1 addition & 0 deletions monetio/models/hysplit.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"""

import datetime
import sys

Expand Down
1 change: 1 addition & 0 deletions monetio/models/raqms.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
More information: http://raqms-ops.ssec.wisc.edu/
"""

import xarray as xr


Expand Down
1 change: 1 addition & 0 deletions monetio/obs/aeronet.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
AERONET
"""

import warnings
from datetime import datetime
from functools import lru_cache
Expand Down
1 change: 1 addition & 0 deletions monetio/obs/cems_mod.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Python 3
#################################################################
"""

import datetime
import os

Expand Down
3 changes: 2 additions & 1 deletion monetio/obs/ish.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
https://www.ncei.noaa.gov/products/land-based-station/integrated-surface-database
"""

import dask
import dask.dataframe as dd
import numpy as np
Expand Down Expand Up @@ -192,7 +193,7 @@ def _clean(frame):
def _decode_bytes(df):
if df.empty:
return df
bytes_cols = [col for col in df.columns if type(df[col][0]) == bytes]
bytes_cols = [col for col in df.columns if type(df[col][0]) is bytes]
with pd.option_context("mode.chained_assignment", None):
df.loc[:, bytes_cols] = df[bytes_cols].apply(
lambda x: x.str.decode("utf-8"),
Expand Down
1 change: 1 addition & 0 deletions monetio/obs/ish_lite.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
--- https://www.ncei.noaa.gov/products/land-based-station/integrated-surface-database
"""

import numpy as np
import pandas as pd

Expand Down
1 change: 0 additions & 1 deletion monetio/obs/nadp.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
""" READS NAPD DATA """


import pandas as pd
from numpy import nan

Expand Down
1 change: 1 addition & 0 deletions monetio/obs/openaq.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
savecols : type
Description of attribute `savecols`.
"""

import json

import pandas as pd
Expand Down
1 change: 1 addition & 0 deletions monetio/profile/geoms.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
For more info, see: https://evdc.esa.int/documentation/geoms/
"""

import warnings

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions monetio/profile/gml_ozonesonde.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
More info: https://gml.noaa.gov/ozwv/ozsondes/
"""

import re
import warnings
from typing import NamedTuple, Optional, Tuple, Union
Expand Down
1 change: 1 addition & 0 deletions monetio/sat/_mopitt_l3_mm.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* Dataset instead of DataArray
- created 2021-12 rrb
"""

import glob
from pathlib import Path

Expand Down
1 change: 1 addition & 0 deletions monetio/sat/goes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" this will read the goes_r data"""

import pandas as pd
import xarray as xr

Expand Down
1 change: 1 addition & 0 deletions monetio/sat/lpdaac_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
Last Updated: 11/20/2018
---------------------------------------------------------------------------------------------------
"""

import argparse
import os
import time
Expand Down
6 changes: 3 additions & 3 deletions monetio/sat/nesdis_edr_viirs.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ def read_data(fname, lat, lon, date):
da.attrs["units"] = ""
da.name = "VIIRS EDR AOD"
da.attrs["long_name"] = "Aerosol Optical Depth"
da.attrs[
"source"
] = "ftp://ftp.star.nesdis.noaa.gov/pub/smcd/jhuang/npp.viirs.aerosol.data/edraot550"
da.attrs["source"] = (
"ftp://ftp.star.nesdis.noaa.gov/pub/smcd/jhuang/npp.viirs.aerosol.data/edraot550"
)
return da


Expand Down
6 changes: 3 additions & 3 deletions monetio/sat/nesdis_eps_viirs.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ def read_data(fname, lat, lon, date):
da.attrs["units"] = ""
da.name = "VIIRS EPS AOT"
da.attrs["long_name"] = "Aerosol Optical Thickness"
da.attrs[
"source"
] = "ftp://ftp.star.nesdis.noaa.gov/pub/smcd/VIIRS_Aerosol/npp.viirs.aerosol.data/epsaot550"
da.attrs["source"] = (
"ftp://ftp.star.nesdis.noaa.gov/pub/smcd/VIIRS_Aerosol/npp.viirs.aerosol.data/epsaot550"
)
return da


Expand Down
30 changes: 15 additions & 15 deletions monetio/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,30 +321,30 @@ def calc_13_category_usda_soil_type(clay, sand, silt):

stype = zeros(clay.shape)
stype[where((silt + clay * 1.5 < 15.0) & (clay != 255))] = 1.0 # SAND
stype[
where((silt + 1.5 * clay >= 15.0) & (silt + 1.5 * clay < 30) & (clay != 255))
] = 2.0 # Loamy Sand
stype[where((silt + 1.5 * clay >= 15.0) & (silt + 1.5 * clay < 30) & (clay != 255))] = (
2.0 # Loamy Sand
)
stype[
where((clay >= 7.0) & (clay < 20) & (sand > 52) & (silt + 2 * clay >= 30) & (clay != 255))
] = 3.0 # Sandy Loam (cond 1)
stype[
where((clay < 7) & (silt < 50) & (silt + 2 * clay >= 30) & (clay != 255))
] = 3 # sandy loam (cond 2)
stype[
where((silt >= 50) & (clay >= 12) & (clay < 27) & (clay != 255))
] = 4 # silt loam (cond 1)
stype[where((clay < 7) & (silt < 50) & (silt + 2 * clay >= 30) & (clay != 255))] = (
3 # sandy loam (cond 2)
)
stype[where((silt >= 50) & (clay >= 12) & (clay < 27) & (clay != 255))] = (
4 # silt loam (cond 1)
)
stype[where((silt >= 50) & (silt < 80) & (clay < 12) & (clay != 255))] = 4 # silt loam (cond 2)
stype[where((silt >= 80) & (clay < 12) & (clay != 255))] = 5 # silt
stype[
where((clay >= 7) & (clay < 27) & (silt >= 28) & (silt < 50) & (sand <= 52) & (clay != 255))
] = 6 # loam
stype[
where((clay >= 20) & (clay < 35) & (silt < 28) & (sand > 45) & (clay != 255))
] = 7 # sandy clay loam
stype[where((clay >= 20) & (clay < 35) & (silt < 28) & (sand > 45) & (clay != 255))] = (
7 # sandy clay loam
)
stype[where((clay >= 27) & (clay < 40.0) & (sand > 40) & (clay != 255))] = 8 # silt clay loam
stype[
where((clay >= 27) & (clay < 40.0) & (sand > 20) & (sand <= 45) & (clay != 255))
] = 9 # clay loam
stype[where((clay >= 27) & (clay < 40.0) & (sand > 20) & (sand <= 45) & (clay != 255))] = (
9 # clay loam
)
stype[where((clay >= 35) & (sand > 45) & (clay != 255))] = 10 # sandy clay
stype[where((clay >= 40) & (silt >= 40) & (clay != 255))] = 11 # silty clay
stype[where((clay >= 40) & (sand <= 45) & (silt < 40) & (clay != 255))] = 12 # clay
Expand Down
2 changes: 1 addition & 1 deletion tests/test_ish.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def test_ish_read_url_direct():
assert set(df.columns) - set(orig_names) == {"time"}
assert set(orig_names) - set(df.columns) == {"date", "htime", "latitude", "longitude"}

assert type(df.t_quality[0]) == str
assert type(df.t_quality[0]) is str


def test_ish_small_timeout_fails():
Expand Down

0 comments on commit 56eef95

Please sign in to comment.