Skip to content

Commit

Permalink
Merge branch 'noaa-oar-arl:stable' into feature/viirs_aws_gridded
Browse files Browse the repository at this point in the history
  • Loading branch information
bbakernoaa authored Nov 18, 2024
2 parents 65fea0c + 7097a01 commit be835c4
Show file tree
Hide file tree
Showing 14 changed files with 1,418 additions and 204 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
schedule:
- cron: "0 12 * * 1"

env:
OPENAQ_API_KEY: "${{ secrets.OPENAQ_API_KEY }}"

jobs:
test:
name: Test (Py ${{ matrix.python-version }})
Expand Down Expand Up @@ -42,14 +45,15 @@ jobs:
create-args: >-
python=${{ matrix.python-version }}
attrs=22.2.0
aioitertools=0.11.0
- name: Test with pytest
run: pytest -n auto -v -W "ignore:Downloading test file:UserWarning::"
run: pytest -n auto -v -rsx -W "ignore:Downloading test file:UserWarning::"

- name: Test with pytspack installed
run: |
pip install https://github.com/noaa-oar-arl/pytspack/archive/master.zip
pytest -n auto -v -k with_pytspack
pytest -n auto -v -rsx -k with_pytspack
docs:
name: Check docs build
Expand Down
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ repos:
exclude: tdump\.[0-9]*
- id: end-of-file-fixer
- id: check-docstring-first
exclude: monetio/obs/openaq_v2\.py
- id: check-yaml

- repo: https://github.com/asottile/pyupgrade
Expand Down
18 changes: 16 additions & 2 deletions monetio/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
from . import grids
from .models import camx, cmaq, fv3chem, hysplit, hytraj, ncep_grib, pardump, prepchem, raqms
from .obs import aeronet, airnow, aqs, cems, crn, improve, ish, ish_lite, nadp, openaq, pams
from .obs import (
aeronet,
airnow,
aqs,
cems,
crn,
improve,
ish,
ish_lite,
nadp,
openaq,
openaq_v2,
pams,
)
from .profile import geoms, gml_ozonesonde, icartt, tolnet
from .sat import goes

__version__ = "0.2.6"
__version__ = "0.2.7"

__all__ = [
"__version__",
Expand All @@ -29,6 +42,7 @@
"ish_lite",
"nadp",
"openaq",
"openaq_v2",
"pams",
#
# profile obs
Expand Down
12 changes: 9 additions & 3 deletions monetio/models/_camx_mm.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ def open_mfdataset(
dset = add_met_data_3D(dset, dset_met)
if "alt_agl_m_mid" in dset.variables:
var_list = var_list + ["alt_agl_m_mid"]
if "layer_height_agl" in dset.variables:
var_list = var_list + ["layer_height_agl"]
if "dz_m" in dset.variables:
var_list = var_list + ["dz_m"]
if "pres_pa_mid" in dset.variables:
var_list = var_list + ["pres_pa_mid"]
if "temperature_k" in dset.variables:
Expand Down Expand Up @@ -206,7 +206,7 @@ def add_met_data_3D(d_chem, d_met):
"var_desc": "pressure",
}
if ("z" in d_met.variables) or ("ZGRID_M" in d_met.variables):
d_chem["alt_agl_m_mid"], d_chem["layer_height_agl"] = _calc_midlayer_height_agl(d_met)
d_chem["alt_agl_m_mid"], d_chem["dz_m"] = _calc_midlayer_height_agl(d_met)
else:
warnings.warn("No altitude AGL was found.")

Expand Down Expand Up @@ -458,6 +458,12 @@ def _calc_midlayer_height_agl(dset):
alt_agl_m_mid[:, :, :, :] = mid_layer_height
alt_agl_m_mid.attrs["var_desc"] = "Layer height above ground level at midpoint"
alt_agl_m_mid.attrs["long_name"] = "Height AGL at midpoint"

dz_m = xr.zeros_like(layer_height_agl)
dz_m[:, 0, :, :] = layer_height_agl[:, 0, :, :].values
dz_m[:, 1:, :, :] = layer_height_agl[:, 1:, :, :].values - layer_height_agl[:, :-1, :, :].values
dz_m.attrs["long_name"] = "dz in meters"
dz_m.attrs["var_desc"] = "Layer thickness in meters"
return alt_agl_m_mid, layer_height_agl


Expand Down
2 changes: 2 additions & 0 deletions monetio/models/_wrfchem_mm.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ def open_mfdataset(
var_wrf = getvar(
wrflist, var, timeidx=ALL_TIMES, method="cat", squeeze=False, units="m"
)
if var == "zstag":
var_wrf = var_wrf.rename("zstag")
else:
var_wrf = getvar(wrflist, var, timeidx=ALL_TIMES, method="cat", squeeze=False)
var_wrf_list.append(var_wrf)
Expand Down
2 changes: 2 additions & 0 deletions monetio/obs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
ish_lite,
nadp,
openaq,
openaq_v2,
pams,
)

Expand All @@ -25,6 +26,7 @@
"cems_mod",
"nadp",
"openaq",
"openaq_v2",
"pams",
]

Expand Down
Loading

0 comments on commit be835c4

Please sign in to comment.