Skip to content

error in Finding_Coincident_Airborne_and_Orbital_Data notebook on latest xarray #59

Description

@itcarroll

To reproduce, launch a binder with the latest earthaccess, and try the following in a console.

import earthaccess

aviris_collection_query = earthaccess.collection_query().keyword('AVIRIS-3')
aviris_collection_query.fields(['Shortname', 'EntryTitle','Version']).get()

This may just be a query style that pre-dates earthaccess.search_datasets or it may mean to do something nifty that I haven't realized.
Either way, it raises a serialization error.

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
File [/srv/conda/envs/notebook/lib/python3.12/site-packages/IPython/core/formatters.py:770](https://hub.2i2c.mybinder.org/srv/conda/envs/notebook/lib/python3.12/site-packages/IPython/core/formatters.py#line=769), in PlainTextFormatter.__call__(self, obj)
    763 stream = StringIO()
    764 printer = pretty.RepresentationPrinter(stream, self.verbose,
    765     self.max_width, self.newline,
    766     max_seq_length=self.max_seq_length,
    767     singleton_pprinters=self.singleton_printers,
    768     type_pprinters=self.type_printers,
    769     deferred_pprinters=self.deferred_printers)
--> 770 printer.pretty(obj)
    771 printer.flush()
    772 return stream.getvalue()

File [/srv/conda/envs/notebook/lib/python3.12/site-packages/IPython/lib/pretty.py:386](https://hub.2i2c.mybinder.org/srv/conda/envs/notebook/lib/python3.12/site-packages/IPython/lib/pretty.py#line=385), in RepresentationPrinter.pretty(self, obj)
    383 for cls in _get_mro(obj_class):
    384     if cls in self.type_pprinters:
    385         # printer registered in self.type_pprinters
--> 386         return self.type_pprinters[cls](obj, self, cycle)
    387     else:
    388         # deferred printer
    389         printer = self._in_deferred_types(cls)

File [/srv/conda/envs/notebook/lib/python3.12/site-packages/IPython/lib/pretty.py:641](https://hub.2i2c.mybinder.org/srv/conda/envs/notebook/lib/python3.12/site-packages/IPython/lib/pretty.py#line=640), in _seq_pprinter_factory.<locals>.inner(obj, p, cycle)
    639         p.text(',')
    640         p.breakable()
--> 641     p.pretty(x)
    642 if len(obj) == 1 and isinstance(obj, tuple):
    643     # Special case for 1-item tuples.
    644     p.text(',')

File [/srv/conda/envs/notebook/lib/python3.12/site-packages/IPython/lib/pretty.py:411](https://hub.2i2c.mybinder.org/srv/conda/envs/notebook/lib/python3.12/site-packages/IPython/lib/pretty.py#line=410), in RepresentationPrinter.pretty(self, obj)
    400                         return meth(obj, self, cycle)
    401                 if (
    402                     cls is not object
    403                     # check if cls defines __repr__
   (...)    409                     and callable(_safe_getattr(cls, "__repr__", None))
    410                 ):
--> 411                     return _repr_pprint(obj, self, cycle)
    413     return _default_pprint(obj, self, cycle)
    414 finally:

File [/srv/conda/envs/notebook/lib/python3.12/site-packages/IPython/lib/pretty.py:786](https://hub.2i2c.mybinder.org/srv/conda/envs/notebook/lib/python3.12/site-packages/IPython/lib/pretty.py#line=785), in _repr_pprint(obj, p, cycle)
    784 """A pprint that just redirects to the normal repr function."""
    785 # Find newlines and replace them with p.break_()
--> 786 output = repr(obj)
    787 lines = output.splitlines()
    788 with p.group():

File [~/earthaccess/results.py:315](https://hub.2i2c.mybinder.org/user/earthaccess-dev-earthaccess-3x4303p0/earthaccess/results.py#line=314), in DataCollection.__repr__(self)
    314 def __repr__(self) -> str:
--> 315     return json.dumps(
    316         self.render_dict,
    317         sort_keys=False,
    318         indent=2,
    319         separators=(",", ": "),
    320     )

File [/srv/conda/envs/notebook/lib/python3.12/json/__init__.py:238](https://hub.2i2c.mybinder.org/srv/conda/envs/notebook/lib/python3.12/json/__init__.py#line=237), in dumps(obj, skipkeys, ensure_ascii, check_circular, allow_nan, cls, indent, separators, default, sort_keys, **kw)
    232 if cls is None:
    233     cls = JSONEncoder
    234 return cls(
    235     skipkeys=skipkeys, ensure_ascii=ensure_ascii,
    236     check_circular=check_circular, allow_nan=allow_nan, indent=indent,
    237     separators=separators, default=default, sort_keys=sort_keys,
--> 238     **kw).encode(obj)

File [/srv/conda/envs/notebook/lib/python3.12/json/encoder.py:202](https://hub.2i2c.mybinder.org/srv/conda/envs/notebook/lib/python3.12/json/encoder.py#line=201), in JSONEncoder.encode(self, o)
    200 chunks = self.iterencode(o, _one_shot=True)
    201 if not isinstance(chunks, (list, tuple)):
--> 202     chunks = list(chunks)
    203 return ''.join(chunks)

File [/srv/conda/envs/notebook/lib/python3.12/json/encoder.py:432](https://hub.2i2c.mybinder.org/srv/conda/envs/notebook/lib/python3.12/json/encoder.py#line=431), in _make_iterencode.<locals>._iterencode(o, _current_indent_level)
    430     yield from _iterencode_list(o, _current_indent_level)
    431 elif isinstance(o, dict):
--> 432     yield from _iterencode_dict(o, _current_indent_level)
    433 else:
    434     if markers is not None:

File [/srv/conda/envs/notebook/lib/python3.12/json/encoder.py:406](https://hub.2i2c.mybinder.org/srv/conda/envs/notebook/lib/python3.12/json/encoder.py#line=405), in _make_iterencode.<locals>._iterencode_dict(dct, _current_indent_level)
    404         else:
    405             chunks = _iterencode(value, _current_indent_level)
--> 406         yield from chunks
    407 if newline_indent is not None:
    408     _current_indent_level -= 1

File [/srv/conda/envs/notebook/lib/python3.12/json/encoder.py:439](https://hub.2i2c.mybinder.org/srv/conda/envs/notebook/lib/python3.12/json/encoder.py#line=438), in _make_iterencode.<locals>._iterencode(o, _current_indent_level)
    437         raise ValueError("Circular reference detected")
    438     markers[markerid] = o
--> 439 o = _default(o)
    440 yield from _iterencode(o, _current_indent_level)
    441 if markers is not None:

File [/srv/conda/envs/notebook/lib/python3.12/json/encoder.py:180](https://hub.2i2c.mybinder.org/srv/conda/envs/notebook/lib/python3.12/json/encoder.py#line=179), in JSONEncoder.default(self, o)
    161 def default(self, o):
    162     """Implement this method in a subclass such that it returns
    163     a serializable object for ``o``, or calls the base implementation
    164     (to raise a ``TypeError``).
   (...)    178 
    179     """
--> 180     raise TypeError(f'Object of type {o.__class__.__name__} '
    181                     f'is not JSON serializable')

TypeError: Object of type set is not JSON serializable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions