Giter VIP home page Giter VIP logo

Comments (5)

agstephens avatar agstephens commented on August 21, 2024

Possible related issue:

roocs/clisops#65

from daops.

ellesmith88 avatar ellesmith88 commented on August 21, 2024

@agstephens @cehbrecht

This is actually related to #61 but this time we get a different error because this is a curvilinear grid, and subset_bbox tries to mask variables after the initial subset.

The longitude bounds mean that there is no x data in the requested subset.

I think we need an extra check in subset_bbox for the curvilinear case along the lines of

if da[lat].size == 0 or da[lon].size == 0:
    raise ValueError(
        "There were no valid data points found in the requested subset. Please expand "
        "the area covered by the bounding box."
    )

as well as the check implemented for #61, which checks after the level and time subsets as well.

from daops.

ellesmith88 avatar ellesmith88 commented on August 21, 2024

The order of the latitude bounds doesn't make a difference in this case because the bounds get flipped by assign_bounds which is called here: https://github.com/roocs/clisops/blob/3e89de464db8569126b91aaa2b1ad8aa50eade2d/clisops/core/subset.py#L834-L836

from daops.

ellesmith88 avatar ellesmith88 commented on August 21, 2024

I tried to recreate this with a test dataset - still curvilinear and tos but a different dataset (/badc/cmip6/data/CMIP6/CMIP/MPI-M/MPI-ESM1-2-HR/historical/r1i1p1f1/Omon/tos/gn/v20190710/). I used one time step with the full lat/lon.

I've tried various lat/lon bounds but can't get the same issue, however it has identified another error that can occur with curvilinear grids when the lat/ lon bounds are too small:

clisops/ops/subset.py:168: in subset
    return op.process()
clisops/ops/base_operation.py:89: in process
    processed_ds = self._calculate()
clisops/ops/subset.py:64: in _calculate
    result = subset_bbox(ds, **self.params)
clisops/core/subset.py:251: in func_checker
    return func(*args, **kwargs)
clisops/core/subset.py:855: in subset_bbox
    coord=da[d], bounds=[coords.min().values, coords.max().values], dim=d
../venv/lib/python3.7/site-packages/xarray/core/common.py:46: in wrapped_func
    return self.reduce(func, dim, axis, skipna=skipna, **kwargs)
../venv/lib/python3.7/site-packages/xarray/core/dataarray.py:2518: in reduce
    var = self.variable.reduce(func, dim, axis, keep_attrs, keepdims, **kwargs)
../venv/lib/python3.7/site-packages/xarray/core/variable.py:1633: in reduce
    data = func(self.data, **kwargs)
../venv/lib/python3.7/site-packages/xarray/core/duck_array_ops.py:337: in f
    return func(values, axis=axis, **kwargs)
../venv/lib/python3.7/site-packages/xarray/core/duck_array_ops.py:56: in f
    return wrapped(*args, **kwargs)
<__array_function__ internals>:6: in amin
    ???
../venv/lib/python3.7/site-packages/numpy/core/fromnumeric.py:2793: in amin
    keepdims=keepdims, initial=initial, where=where)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

obj = array([], dtype=int32), ufunc = <ufunc 'minimum'>, method = 'min', axis = None, dtype = None, out = None, kwargs = {'initial': <no value>, 'keepdims': <no value>, 'where': <no value>}, passkwargs = {}

    def _wrapreduction(obj, ufunc, method, axis, dtype, out, **kwargs):
        passkwargs = {k: v for k, v in kwargs.items()
                      if v is not np._NoValue}
    
        if type(obj) is not mu.ndarray:
            try:
                reduction = getattr(obj, method)
            except AttributeError:
                pass
            else:
                # This branch is needed for reductions like any which don't
                # support a dtype.
                if dtype is not None:
                    return reduction(axis=axis, dtype=dtype, out=out, **passkwargs)
                else:
                    return reduction(axis=axis, out=out, **passkwargs)
    
>       return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
E       ValueError: zero-size array to reduction operation minimum which has no identity

../venv/lib/python3.7/site-packages/numpy/core/fromnumeric.py:90: ValueError

from daops.

ellesmith88 avatar ellesmith88 commented on August 21, 2024

closed by roocs/clisops#156

from daops.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.