Skip to content

Commit

Permalink
Merge pull request #242 from akrherz/ero_link
Browse files Browse the repository at this point in the history
Drop shell usage
  • Loading branch information
akrherz authored May 31, 2024
2 parents a76ec8c + 96385cc commit e52a5aa
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 75 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ repos:
types: [python]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.4.4"
rev: "v0.4.7"
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format

- repo: https://github.com/tox-dev/pyproject-fmt
rev: '2.0.3'
rev: '2.1.3'
hooks:
- id: pyproject-fmt

144 changes: 78 additions & 66 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,38 @@
build-backend = "setuptools.build_meta"
requires = [
"setuptools",
"setuptools_scm",
"setuptools-scm",
"wheel",
]

[project]
dynamic = [
"version",
]
name = "pywwa"
authors = [
{name = "daryl herzmann", email = "[email protected]"},
]
description = "A suite of parsers and utils for NWS products."
keywords = [
"meteorology",
"nws",
]
license = {"text" = "Apache"}
description = "A suite of parsers and utils for NWS products."
license = { "text" = "Apache" }
authors = [
{ name = "daryl herzmann", email = "[email protected]" },
]
classifiers = [
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
dynamic = [
"version",
]
dependencies = [
"click",
"geopandas",
"metar>=1.7",
"metpy",
"netCDF4",
"netcdf4",
"numpy",
"pandas",
"pint",
Expand All @@ -40,65 +48,69 @@ dependencies = [
"twisted",
]

[tool.pytest.ini_options]
filterwarnings = ["ignore:numpy.ndarray size changed:RuntimeWarning"]
urls.Changelog = "https://github.com/akrherz/pyWWA/blob/main/CHANGELOG.md"
urls.Documentation = "https://github.com/akrherz/pyWWA"
urls.Homepage = "https://mesonet.agron.iastate.edu"
urls.Issues = "https://github.com/akrherz/pyWWA/issues"
urls.Repository = "https://github.com/akrherz/pyWWA.git"
scripts.pywwa-parse-afos-dump = "pywwa.workflows.afos_dump:main"
scripts.pywwa-parse-aviation = "pywwa.workflows.aviation:main"
scripts.pywwa-parse-bufr-surface = "pywwa.workflows.bufr_surface:main"
scripts.pywwa-parse-cf6 = "pywwa.workflows.cf6:main"
scripts.pywwa-parse-cli = "pywwa.workflows.cli:main"
scripts.pywwa-parse-cwa = "pywwa.workflows.cwa:main"
scripts.pywwa-parse-dsm = "pywwa.workflows.dsm:main"
scripts.pywwa-parse-dsm2afos = "pywwa.workflows.dsm2afos:main"
scripts.pywwa-parse-ero = "pywwa.workflows.ero:main"
scripts.pywwa-parse-fake-afos-dump = "pywwa.workflows.fake_afos_dump:main"
scripts.pywwa-parse-fd = "pywwa.workflows.fd:main"
scripts.pywwa-parse-ffg = "pywwa.workflows.ffg:main"
scripts.pywwa-parse-gairmet = "pywwa.workflows.gairmet:main"
scripts.pywwa-parse-generic = "pywwa.workflows.generic:main"
scripts.pywwa-parse-gini2gis = "pywwa.workflows.gini2gis:main"
scripts.pywwa-parse-hml = "pywwa.workflows.hml:main"
scripts.pywwa-parse-lsr = "pywwa.workflows.lsr:main"
scripts.pywwa-parse-mcd = "pywwa.workflows.mcd:main"
scripts.pywwa-parse-metar = "pywwa.workflows.metar:main"
scripts.pywwa-parse-mos = "pywwa.workflows.mos:main"
scripts.pywwa-parse-nexrad3-attr = "pywwa.workflows.nexrad3_attr:main"
scripts.pywwa-parse-nldn = "pywwa.workflows.nldn:main"
scripts.pywwa-parse-pirep = "pywwa.workflows.pirep:main"
scripts.pywwa-parse-rr7 = "pywwa.workflows.rr7:main"
scripts.pywwa-parse-scp = "pywwa.workflows.scp:main"
scripts.pywwa-parse-shef = "pywwa.workflows.shef:main"
scripts.pywwa-parse-spc = "pywwa.workflows.spc:main"
scripts.pywwa-parse-spe = "pywwa.workflows.spe:main"
scripts.pywwa-parse-split-mav = "pywwa.workflows.split_mav:main"
scripts.pywwa-parse-sps = "pywwa.workflows.sps:main"
scripts.pywwa-parse-taf = "pywwa.workflows.taf:main"
scripts.pywwa-parse-vtec = "pywwa.workflows.vtec:main"
scripts.pywwa-parse-watch = "pywwa.workflows.watch:main"
scripts.pywwa-parse-xteus = "pywwa.workflows.xteus:main"
scripts.pywwa-spammer = "pywwa.workflows.spammer:main"

[tool.setuptools_scm]
version_scheme = "post-release"

[tool.ruff]
lint.select = [
"B", # bugbear
"E",
"F",
"I",
"T",
]
target-version = "py39"
line-length = 79

[tool.ruff.lint.per-file-ignores]
"goes/*.py" = ["T201"]
"util/*.py" = ["T201"]
lint.select = [
"B", # bugbear
"E",
"F",
"I",
"T",
]
lint.per-file-ignores."goes/*.py" = [
"T201",
]
lint.per-file-ignores."util/*.py" = [
"T201",
]

[project.scripts]
pywwa-parse-afos-dump = "pywwa.workflows.afos_dump:main"
pywwa-parse-aviation = "pywwa.workflows.aviation:main"
pywwa-parse-bufr-surface = "pywwa.workflows.bufr_surface:main"
pywwa-parse-cf6 = "pywwa.workflows.cf6:main"
pywwa-parse-cli = "pywwa.workflows.cli:main"
pywwa-parse-cwa = "pywwa.workflows.cwa:main"
pywwa-parse-dsm = "pywwa.workflows.dsm:main"
pywwa-parse-dsm2afos = "pywwa.workflows.dsm2afos:main"
pywwa-parse-ero = "pywwa.workflows.ero:main"
pywwa-parse-fake-afos-dump = "pywwa.workflows.fake_afos_dump:main"
pywwa-parse-fd = "pywwa.workflows.fd:main"
pywwa-parse-ffg = "pywwa.workflows.ffg:main"
pywwa-parse-gairmet = "pywwa.workflows.gairmet:main"
pywwa-parse-generic = "pywwa.workflows.generic:main"
pywwa-parse-gini2gis = "pywwa.workflows.gini2gis:main"
pywwa-parse-hml = "pywwa.workflows.hml:main"
pywwa-parse-lsr = "pywwa.workflows.lsr:main"
pywwa-parse-mcd = "pywwa.workflows.mcd:main"
pywwa-parse-metar = "pywwa.workflows.metar:main"
pywwa-parse-mos = "pywwa.workflows.mos:main"
pywwa-parse-nexrad3-attr = "pywwa.workflows.nexrad3_attr:main"
pywwa-parse-nldn = "pywwa.workflows.nldn:main"
pywwa-parse-pirep = "pywwa.workflows.pirep:main"
pywwa-parse-rr7 = "pywwa.workflows.rr7:main"
pywwa-parse-scp = "pywwa.workflows.scp:main"
pywwa-parse-shef = "pywwa.workflows.shef:main"
pywwa-parse-spc = "pywwa.workflows.spc:main"
pywwa-parse-spe = "pywwa.workflows.spe:main"
pywwa-parse-split-mav = "pywwa.workflows.split_mav:main"
pywwa-parse-sps = "pywwa.workflows.sps:main"
pywwa-parse-taf = "pywwa.workflows.taf:main"
pywwa-parse-vtec = "pywwa.workflows.vtec:main"
pywwa-parse-watch = "pywwa.workflows.watch:main"
pywwa-parse-xteus = "pywwa.workflows.xteus:main"
pywwa-spammer = "pywwa.workflows.spammer:main"
[project.urls]
Changelog = "https://github.com/akrherz/pyWWA/blob/main/CHANGELOG.md"
Documentation = "https://github.com/akrherz/pyWWA"
Homepage = "https://mesonet.agron.iastate.edu"
Issues = "https://github.com/akrherz/pyWWA/issues"
Repository = "https://github.com/akrherz/pyWWA.git"
[tool.setuptools_scm]
version_scheme = "post-release"
[tool.pytest.ini_options]
filterwarnings = [
"ignore:numpy.ndarray size changed:RuntimeWarning",
]
20 changes: 13 additions & 7 deletions util/wpc_ero_geojson.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,19 @@ def send_to_ldm(gdf, meta, maxissue, day, cycle):
with open(tmpfn.name, "w", encoding="utf-8") as tmpfh:
json.dump(jdict, tmpfh)

cmd = (
f"pqinsert -i -p 'data ac {maxissue:%Y%m%d%H%M} gis/geojson/wpc_ero/"
f"eroday{day}.geojson GIS/wpc_ero/eroday{day}_{cycle}z.geojson "
f"geojson' {tmpfn.name}"
)
LOG.info(cmd)
subprocess.call(cmd, shell=True)
cmd = [
"pqinsert",
"-i",
"-p",
(
f"data ac {maxissue:%Y%m%d%H%M} gis/geojson/wpc_ero/"
f"eroday{day}.geojson GIS/wpc_ero/eroday{day}_{cycle}z.geojson "
"geojson"
),
tmpfn.name,
]
LOG.info(" ".join(cmd))
subprocess.call(cmd)
os.unlink(tmpfn.name)


Expand Down

0 comments on commit e52a5aa

Please sign in to comment.