Skip to content

Commit

Permalink
Temporarily remove longitude/latitude 2D xarray coordinates
Browse files Browse the repository at this point in the history
  • Loading branch information
djhoese committed Jul 2, 2019
1 parent 5def3dc commit 714fb21
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 16 deletions.
2 changes: 2 additions & 0 deletions satpy/composites/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,7 @@ class FillingCompositor(GenericCompositor):

def __call__(self, projectables, nonprojectables=None, **info):
"""Generate the composite."""
projectables = self.check_areas(projectables)
projectables[1] = projectables[1].fillna(projectables[0])
projectables[2] = projectables[2].fillna(projectables[0])
projectables[3] = projectables[3].fillna(projectables[0])
Expand All @@ -850,6 +851,7 @@ class Filler(GenericCompositor):

def __call__(self, projectables, nonprojectables=None, **info):
"""Generate the composite."""
projectables = self.check_areas(projectables)
filled_projectable = projectables[0].fillna(projectables[1])
return super(Filler, self).__call__([filled_projectable], **info)

Expand Down
10 changes: 5 additions & 5 deletions satpy/readers/yaml_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,13 +679,13 @@ def _make_area_from_coords(self, coords):
sdef = None
if sdef is None:
sdef = SwathDefinition(*coords)
sensor_str = '_'.join(self.info['sensors'])
shape_str = '_'.join(map(str, coords[0].shape))
sdef.name = "{}_{}_{}_{}".format(sensor_str, shape_str,
coords[0].attrs['name'],
coords[1].attrs['name'])
if key is not None:
self.coords_cache[key] = sdef
sensor_str = '_'.join(self.info['sensors'])
shape_str = '_'.join(map(str, coords[0].shape))
sdef.name = "{}_{}_{}_{}".format(sensor_str, shape_str,
coords[0].attrs['name'],
coords[1].attrs['name'])
return sdef
else:
raise ValueError(
Expand Down
3 changes: 2 additions & 1 deletion satpy/resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,8 @@ def add_crs_xy_coords(data_arr, area):
lats.attrs.setdefault('standard_name', 'latitude')
lats.attrs.setdefault('long_name', 'latitude')
lats.attrs.setdefault('units', 'degrees_north')
data_arr = data_arr.assign_coords(longitude=lons, latitude=lats)
# See https://github.com/pydata/xarray/issues/3068
# data_arr = data_arr.assign_coords(longitude=lons, latitude=lats)
else:
# Gridded data (AreaDefinition/StackedAreaDefinition)
data_arr = add_xy_coords(data_arr, area, crs=crs)
Expand Down
21 changes: 11 additions & 10 deletions satpy/tests/test_resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,16 +596,17 @@ def test_swath_def_coordinates(self):
dims=('y', 'x'),
)
new_data_arr = add_crs_xy_coords(data_arr, area_def)
self.assertIn('longitude', new_data_arr.coords)
self.assertIn('units', new_data_arr.coords['longitude'].attrs)
self.assertEqual(
new_data_arr.coords['longitude'].attrs['units'], 'degrees_east')
self.assertIsInstance(new_data_arr.coords['longitude'].data, da.Array)
self.assertIn('latitude', new_data_arr.coords)
self.assertIn('units', new_data_arr.coords['latitude'].attrs)
self.assertEqual(
new_data_arr.coords['latitude'].attrs['units'], 'degrees_north')
self.assertIsInstance(new_data_arr.coords['latitude'].data, da.Array)
# See https://github.com/pydata/xarray/issues/3068
# self.assertIn('longitude', new_data_arr.coords)
# self.assertIn('units', new_data_arr.coords['longitude'].attrs)
# self.assertEqual(
# new_data_arr.coords['longitude'].attrs['units'], 'degrees_east')
# self.assertIsInstance(new_data_arr.coords['longitude'].data, da.Array)
# self.assertIn('latitude', new_data_arr.coords)
# self.assertIn('units', new_data_arr.coords['latitude'].attrs)
# self.assertEqual(
# new_data_arr.coords['latitude'].attrs['units'], 'degrees_north')
# self.assertIsInstance(new_data_arr.coords['latitude'].data, da.Array)

if CRS is not None:
self.assertIn('crs', new_data_arr.coords)
Expand Down

0 comments on commit 714fb21

Please sign in to comment.