Skip to content

GOES 16 True Color Notebook Broken #94

@julienchastang

Description

@julienchastang
  • recent python-training conda env
  • Run GOES 16 True Color Notebook

I'll assign this issue to myself. Let me know if anyone has any insights here. It used to work so we are either misusing a more recent version of the MetPy API, or something inside MetPy broke.

---------------------------------------------------------------------------
DimensionalityError                       Traceback (most recent call last)
/opt/conda/envs/python-training/lib/python3.7/site-packages/metpy/xarray.py in _fixup_coords(self, var)
    548                 try:
--> 549                     var.coords[coord_name].metpy.convert_units('meters')
    550                 except DimensionalityError:  # Radians!

/opt/conda/envs/python-training/lib/python3.7/site-packages/metpy/xarray.py in convert_units(self, units)
    144         """Convert the data values to different units in-place."""
--> 145         self.unit_array = self.unit_array.to(units)
    146 

/opt/conda/envs/python-training/lib/python3.7/site-packages/pint/quantity.py in to(self, other, *contexts, **ctx_kwargs)
    590 
--> 591         magnitude = self._convert_magnitude_not_inplace(other, *contexts, **ctx_kwargs)
    592 

/opt/conda/envs/python-training/lib/python3.7/site-packages/pint/quantity.py in _convert_magnitude_not_inplace(self, other, *contexts, **ctx_kwargs)
    539 
--> 540         return self._REGISTRY.convert(self._magnitude, self._units, other)
    541 

/opt/conda/envs/python-training/lib/python3.7/site-packages/pint/registry.py in convert(self, value, src, dst, inplace)
    924 
--> 925         return self._convert(value, src, dst, inplace)
    926 

/opt/conda/envs/python-training/lib/python3.7/site-packages/pint/registry.py in _convert(self, value, src, dst, inplace)
   1761 
-> 1762         return super()._convert(value, src, dst, inplace)
   1763 

/opt/conda/envs/python-training/lib/python3.7/site-packages/pint/registry.py in _convert(self, value, src, dst, inplace)
   1375         if not (src_offset_unit or dst_offset_unit):
-> 1376             return super()._convert(value, src, dst, inplace)
   1377 

/opt/conda/envs/python-training/lib/python3.7/site-packages/pint/registry.py in _convert(self, value, src, dst, inplace, check_dimensionality)
    957             if src_dim != dst_dim:
--> 958                 raise DimensionalityError(src, dst, src_dim, dst_dim)
    959 

DimensionalityError: Cannot convert from 'radian' (dimensionless) to 'meter' ([length])

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
<ipython-input-11-d9ca28bf71fb> in <module>
      1 # We'll use the `CMI_C02` variable as a 'hook' to get the CF metadata.
----> 2 dat = C.metpy.parse_cf('CMI_C02')
      3 
      4 geos = dat.metpy.cartopy_crs
      5 

/opt/conda/envs/python-training/lib/python3.7/site-packages/metpy/xarray.py in parse_cf(self, varname, coordinates)
    518                 var.coords['crs'] = CFProjection(proj_var.attrs)
    519 
--> 520         self._fixup_coords(var)
    521 
    522         # Trying to guess whether we should be adding a crs to this variable's coordinates

/opt/conda/envs/python-training/lib/python3.7/site-packages/metpy/xarray.py in _fixup_coords(self, var)
    553                         height = var.coords['crs'].item()['perspective_point_height']
    554                         scaled_vals = new_data_array.metpy.unit_array * (height * units.meters)
--> 555                         new_data_array.metpy.unit_array = scaled_vals.to('meters')
    556                         var.coords[coord_name] = new_data_array
    557 

/opt/conda/envs/python-training/lib/python3.7/site-packages/metpy/xarray.py in unit_array(self, values)
    138     def unit_array(self, values):
    139         """Set data values from a `pint.Quantity`."""
--> 140         self._data_array.values = values.magnitude
    141         self._units = self._data_array.attrs['units'] = str(values.units)
    142 

/opt/conda/envs/python-training/lib/python3.7/site-packages/xarray/core/common.py in __setattr__(self, name, value)
    260         """
    261         try:
--> 262             object.__setattr__(self, name, value)
    263         except AttributeError as e:
    264             # Don't accidentally shadow custom AttributeErrors, e.g.

/opt/conda/envs/python-training/lib/python3.7/site-packages/xarray/core/dataarray.py in values(self, value)
    560     @values.setter
    561     def values(self, value: Any) -> None:
--> 562         self.variable.values = value
    563 
    564     @property

/opt/conda/envs/python-training/lib/python3.7/site-packages/xarray/core/variable.py in values(self, values)
   2113     def values(self, values):
   2114         raise ValueError(
-> 2115             f"Cannot assign to the .values attribute of dimension coordinate a.k.a IndexVariable {self.name!r}. "
   2116             f"Please use DataArray.assign_coords, Dataset.assign_coords or Dataset.assign as appropriate."
   2117         )

ValueError: Cannot assign to the .values attribute of dimension coordinate a.k.a IndexVariable 'y'. Please use DataArray.assign_coords, Dataset.assign_coords or Dataset.assign as appropriate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions