SlideRuleEarth / sliderule-python

SlideRule Earth Example Notebooks: On-demand, cloud-based processing of satellite mission data (NASA ICESat-2, GEDI, ArcticDEM/REMA, HLS)
https://slideruleearth.io/rtd/
BSD 3-Clause "New" or "Revised" License
41 stars 21 forks source link

Client crashes with empty return #84

Closed jpswinski closed 2 years ago

jpswinski commented 2 years ago

If a processing request returns no data, then the client will crash when it tries to concatenate the results.

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Input In [5], in on_run_clicked(b)
     65 print(f'SlideRule processing request... initiated\r', end="")
     66 perf_start = time.perf_counter()
---> 67 atl06_rsps = runSlideRule()
     68 perf_duration = time.perf_counter() - perf_start
     69 print(f'SlideRule processing request... completed in {perf_duration:.3f} seconds; returned {atl06_rsps.shape[0]} records                                   ')

Input In [5], in runSlideRule()
     54     # make the request to the SlideRule (ATL06-SR) endpoint
     55     # and pass it the request parameters to request ATL06 Data
     56     icesat2.atl06p(parms, asset, callback=demoCB)
---> 58 rsps = geopandas.pd.concat(results)
     59 return rsps

File /opt/conda/envs/sliderule/lib/python3.8/site-packages/pandas/util/_decorators.py:311, in deprecate_nonkeyword_arguments.<locals>.decorate.<locals>.wrapper(*args, **kwargs)
    305 if len(args) > num_allow_args:
    306     warnings.warn(
    307         msg.format(arguments=arguments),
    308         FutureWarning,
    309         stacklevel=stacklevel,
    310     )
--> 311 return func(*args, **kwargs)

File /opt/conda/envs/sliderule/lib/python3.8/site-packages/pandas/core/reshape/concat.py:346, in concat(objs, axis, join, ignore_index, keys, levels, names, verify_integrity, sort, copy)
    142 @deprecate_nonkeyword_arguments(version=None, allowed_args=["objs"])
    143 def concat(
    144     objs: Iterable[NDFrame] | Mapping[Hashable, NDFrame],
   (...)
    153     copy: bool = True,
    154 ) -> DataFrame | Series:
    155     """
    156     Concatenate pandas objects along a particular axis with optional set logic
    157     along the other axes.
   (...)
    344     ValueError: Indexes have overlapping values: ['a']
    345     """
--> 346     op = _Concatenator(
    347         objs,
    348         axis=axis,
    349         ignore_index=ignore_index,
    350         join=join,
    351         keys=keys,
    352         levels=levels,
    353         names=names,
    354         verify_integrity=verify_integrity,
    355         copy=copy,
    356         sort=sort,
    357     )
    359     return op.get_result()

File /opt/conda/envs/sliderule/lib/python3.8/site-packages/pandas/core/reshape/concat.py:403, in _Concatenator.__init__(self, objs, axis, join, keys, levels, names, ignore_index, verify_integrity, copy, sort)
    400     objs = list(objs)
    402 if len(objs) == 0:
--> 403     raise ValueError("No objects to concatenate")
    405 if keys is None:
    406     objs = list(com.not_none(*objs))

ValueError: No objects to concatenate
jpswinski commented 2 years ago

This was an issue with the demo only. The client handled this case, but the demo used a callback in order to provide progress updates, and the callback did not handle it.

Here is the fix: 3cc0038