Skip to content

Commit

Permalink
fix: Correct the test by replacing numpy array to dask array to simul…
Browse files Browse the repository at this point in the history
…ate the real case data
  • Loading branch information
ClementLaplace committed Jan 21, 2025
1 parent f202054 commit 4c25948
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions satpy/tests/compositor_tests/test_lightning.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import datetime
import logging

import dask.array as da
import numpy as np
import pytest
import xarray as xr
Expand All @@ -37,7 +38,7 @@ def test_flash_age_compositor():
attrs_flash_age = {"variable_name": "flash_time","name": "flash_time",
"start_time": datetime.datetime(2024, 8, 1, 10, 50, 0),
"end_time": datetime.datetime(2024, 8, 1, 11, 0, 0),"reader": "li_l2_nc"}
flash_age_value = np.array(["2024-08-01T09:00:00",
flash_age_value = da.array(["2024-08-01T09:00:00",
"2024-08-01T10:00:00", "2024-08-01T10:30:00","2024-08-01T11:00:00"], dtype="datetime64[ns]")
flash_age = xr.DataArray(
flash_age_value,
Expand All @@ -52,7 +53,7 @@ def test_flash_age_compositor():
"standard_name": "ligtning_time"
}
expected_array = xr.DataArray(
np.array([0.0,0.5,1.0]),
da.array([0.0,0.5,1.0]),
dims=["y"],
coords={
"crs": "8B +proj=longlat +ellps=WGS84 +type=crs"
Expand All @@ -69,7 +70,7 @@ def test_empty_array_error(caplog):
"start_time": np.datetime64(datetime.datetime(2024, 8, 1, 10, 0, 0)),
"end_time": datetime.datetime(2024, 8, 1, 11, 0, 0),
"reader": "li_l2_nc"}
flash_age_value = np.array(["2024-08-01T09:00:00"], dtype="datetime64[ns]")
flash_age_value = da.array(["2024-08-01T09:00:00"], dtype="datetime64[ns]")
flash_age = xr.DataArray(
flash_age_value,
dims=["y"],
Expand Down

0 comments on commit 4c25948

Please sign in to comment.