Skip to content

Commit

Permalink
Try more test hacking to get reproducible example
Browse files Browse the repository at this point in the history
  • Loading branch information
djhoese committed Jul 19, 2023
1 parent 7f6b4dd commit 24a1a76
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
12 changes: 0 additions & 12 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,6 @@ jobs:
shell: bash -l {0}
run: |
pytest satpy/tests/enhancement_tests/test_enhancements.py::test_nwcsaf_comps
- name: Run unit tests - enhancement_tests - enhancements
shell: bash -l {0}
run: |
pytest satpy/tests/enhancement_tests/test_enhancements.py
- name: Run unit tests - enhancement_tests - viirs
shell: bash -l {0}
run: |
pytest satpy/tests/enhancement_tests/test_viirs.py
- name: Run unit tests - modifier_tests
shell: bash -l {0}
run: |
pytest satpy/tests/modifier_tests
- name: Run unit tests - scene_tests
shell: bash -l {0}
run: |
Expand Down
12 changes: 7 additions & 5 deletions satpy/tests/enhancement_tests/test_enhancements.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import contextlib
import os
from datetime import datetime
from tempfile import NamedTemporaryFile
from unittest import mock

Expand Down Expand Up @@ -577,23 +578,22 @@ def fake_area():
)
def test_nwcsaf_comps(fake_area, tmp_path, data):
"""Test loading NWCSAF composites."""
return
from satpy.writers import get_enhanced_image

from ... import Scene
(flavour, dvname, altname, palettename, statusname, comp, filelabel, dtp) = _nwcsaf_geo_props[data]
rng = (0, 100) if dtp == "uint8" else (-100, 1000)
now = datetime.utcnow()
if flavour == "geo":
fn = f"S_NWC_{filelabel:s}_MSG2_MSG-N-VISIR_20220124T094500Z.nc"
fn = f"S_NWC_{filelabel:s}_MSG2_MSG-N-VISIR_{now:%Y%m%dT%H%M%S}Z.nc"
reader = "nwcsaf-geo"
id_ = {"satellite_identifier": "MSG4"}
else:
fn = f"S_NWC_{filelabel:s}_noaa20_00000_20230301T1200213Z_20230301T1201458Z.nc"
fn = f"S_NWC_{filelabel:s}_noaa20_00000_{now:%Y%m%dT%H%M%S}0Z_{now:%Y%m%dT%H%M%S}0Z.nc"
reader = "nwcsaf-pps_nc"
id_ = {"platform": "NOAA-20"}
fk = tmp_path / fn
# create a minimally fake netCDF file, otherwise satpy won't load the
# composite
# create a minimally fake netCDF file, otherwise satpy won't load the composite
ds = xr.Dataset(
coords={"nx": [0], "ny": [0]},
attrs={
Expand All @@ -604,6 +604,8 @@ def test_nwcsaf_comps(fake_area, tmp_path, data):
)
ds.attrs.update(id_)
ds.to_netcdf(fk)
import time
time.sleep(1)
# sc = Scene(filenames=[os.fspath(fk)], reader=[reader])
# sc[palettename] = xr.DataArray(
# da.tile(da.arange(256), [3, 1]).T,
Expand Down

0 comments on commit 24a1a76

Please sign in to comment.