Skip to content

Commit

Permalink
Add area definitions to remove unnecessary warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
pnuu committed Dec 15, 2023
1 parent 36b09d1 commit 8ea9e30
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
16 changes: 15 additions & 1 deletion satpy/tests/test_writers.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,13 +548,20 @@ def setUp(self):
import tempfile
from datetime import datetime

from pyresample.geometry import AreaDefinition

from satpy.scene import Scene

adef = AreaDefinition(
"test", "test", "test", "EPSG:4326",
100, 200, (-180., -90., 180., 90.),
)
ds1 = xr.DataArray(
da.zeros((100, 200), chunks=50),
dims=("y", "x"),
attrs={"name": "test",
"start_time": datetime(2018, 1, 1, 0, 0, 0)}
"start_time": datetime(2018, 1, 1, 0, 0, 0),
"area": adef}
)
self.scn = Scene()
self.scn["test"] = ds1
Expand Down Expand Up @@ -650,15 +657,22 @@ def setup_method(self):
import tempfile
from datetime import datetime

from pyresample.geometry import AreaDefinition

from satpy.scene import Scene

adef = AreaDefinition(
"test", "test", "test", "EPSG:4326",
100, 200, (-180., -90., 180., 90.),
)
ds1 = xr.DataArray(
da.zeros((100, 200), chunks=50),
dims=("y", "x"),
attrs={
"name": "test",
"start_time": datetime(2018, 1, 1, 0, 0, 0),
"sensor": "fake_sensor",
"area": adef,
}
)
ds2 = ds1.copy()
Expand Down
18 changes: 16 additions & 2 deletions satpy/tests/writer_tests/test_geotiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,19 @@

def _get_test_datasets_2d():
"""Create a single 2D test dataset."""
from pyresample.geometry import AreaDefinition

adef = AreaDefinition(
"test", "test", "test", "EPSG:4326",
100, 200, (-180., -90., 180., 90.),
)
ds1 = xr.DataArray(
da.zeros((100, 200), chunks=50),
dims=("y", "x"),
attrs={"name": "test",
"start_time": datetime.utcnow(),
"units": "K"}
"units": "K",
"area": adef}
)
return [ds1]

Expand All @@ -54,12 +61,19 @@ def _get_test_datasets_2d_nonlinear_enhancement():

def _get_test_datasets_3d():
"""Create a single 3D test dataset."""
from pyresample.geometry import AreaDefinition

adef = AreaDefinition(
"test", "test", "test", "EPSG:4326",
100, 200, (-180., -90., 180., 90.),
)
ds1 = xr.DataArray(
da.zeros((3, 100, 200), chunks=50),
dims=("bands", "y", "x"),
coords={"bands": ["R", "G", "B"]},
attrs={"name": "test",
"start_time": datetime.utcnow()}
"start_time": datetime.utcnow(),
"area": adef}
)
return [ds1]

Expand Down

0 comments on commit 8ea9e30

Please sign in to comment.