You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I have been pulling hourly meteostat data using 'weighted' method without problem until yesterday. When I rerun code that used to be working, without any changes to the code, I am now getting a MaskError. And the error is pointing to the internal meteostat code. But I didn't even updated the meteostat package before I started running into this error. If I switch the method to 'nearest' I do not run into this error.
It is true that I write code on a cloud based jupyter server and somebody else from my organization might have mess with some python configurations but I have no idea what might happen and how to fix it.
File ~/.local/lib/python3.11/site-packages/meteostat/interface/timeseries.py:221, in TimeSeries._init_time_series(self, loc, start, end, model, flags)
218 # Interpolate data spatially if requested
219 # location is a geographical point
220 if isinstance(loc, Point):
--> 221 self._resolve_point(loc.method, stations, loc.alt, loc.adapt_temp)
223 # Clear cache if auto cleaning is enabled
224 if self.max_age > 0 and self.autoclean:
File ~/.local/lib/python3.11/site-packages/meteostat/interface/meteodata.py:184, in MeteoData._resolve_point(self, method, stations, alt, adapt_temp)
181 pass
183 else:
--> 184 data = data.groupby(pd.Grouper(level="time", freq=self._freq)).apply(
185 weighted_average
186 )
188 # Drop RangeIndex
189 data.index = data.index.droplevel(1)
File ~/.local/lib/python3.11/site-packages/pandas/core/groupby/groupby.py:1824, in GroupBy.apply(self, func, include_groups, *args, **kwargs)
1822 with option_context("mode.chained_assignment", None):
1823 try:
-> 1824 result = self._python_apply_general(f, self._selected_obj)
1825 if (
1826 not isinstance(self.obj, Series)
1827 and self._selection is None
1828 and self._selected_obj.shape != self._obj_with_exclusions.shape
1829 ):
1830 warnings.warn(
1831 message=_apply_groupings_depr.format(
1832 type(self).name, "apply"
(...)
1835 stacklevel=find_stack_level(),
1836 )
File ~/.local/lib/python3.11/site-packages/pandas/core/groupby/groupby.py:1885, in GroupBy._python_apply_general(self, f, data, not_indexed_same, is_transform, is_agg)
1850 @Final
1851 def _python_apply_general(
1852 self,
(...)
1857 is_agg: bool = False,
1858 ) -> NDFrameT:
1859 """
1860 Apply function f in python space
1861
(...)
1883 data after applying f
1884 """
-> 1885 values, mutated = self._grouper.apply_groupwise(f, data, self.axis)
1886 if not_indexed_same is None:
1887 not_indexed_same = mutated
File ~/.local/lib/python3.11/site-packages/pandas/core/groupby/ops.py:919, in BaseGrouper.apply_groupwise(self, f, data, axis)
917 # group might be modified
918 group_axes = group.axes
--> 919 res = f(group)
920 if not mutated and not _is_indexed_like(res, group_axes, axis):
921 mutated = True
File ~/.local/lib/python3.11/site-packages/meteostat/utilities/aggregations.py:20, in weighted_average(step)
15 def weighted_average(step: pd.DataFrame) -> pd.DataFrame:
16 """
17 Calculate weighted average from grouped data
18 """
---> 20 data = np.ma.masked_array(step, np.isnan(step))
21 data = np.ma.average(data, axis=0, weights=data[:, -2])
22 data = data.filled(np.nan)
File /usr/local/lib/python3.11/site-packages/numpy/ma/core.py:2911, in MaskedArray.new(cls, data, mask, dtype, copy, subok, ndmin, fill_value, keep_mask, hard_mask, shrink, order)
2908 else:
2909 msg = "Mask and data not compatible: data size is %i, " +
2910 "mask size is %i."
-> 2911 raise MaskError(msg % (nd, nm))
2912 copy = True
2913 # Set the mask to the new value
MaskError: Mask and data not compatible: data size is 52, mask size is 0.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I have been pulling hourly meteostat data using 'weighted' method without problem until yesterday. When I rerun code that used to be working, without any changes to the code, I am now getting a MaskError. And the error is pointing to the internal meteostat code. But I didn't even updated the meteostat package before I started running into this error. If I switch the method to 'nearest' I do not run into this error.
It is true that I write code on a cloud based jupyter server and somebody else from my organization might have mess with some python configurations but I have no idea what might happen and how to fix it.
Can somebody provide any insight, please?
Beta Was this translation helpful? Give feedback.
All reactions