Skip to content

Pickled items / ItemCollections are large #315

@TomAugspurger

Description

@TomAugspurger

When you make a search, select and item, and pickle it, the bytestream will be (surprisingly) large.

import pystac_client
import pystac

catalog = pystac_client.Client.open("https://planetarycomputer.microsoft.com/api/stac/v1/")
search = catalog.search(collections=["sentinel-2-l2a"], datetime="2022-09-01/2022-09-12", bbox=(68.1766451353734, 7.965534776232332, 97.40256147663614, 35.494009507787766))
items = search.get_all_items()

If we look at the first item:

>>> len(pickle.dumps(items[0]))
51999495

Comare that with PySTAC's size when constructed from a dictionary

>>> len(pickle.dumps(pystac.Item.from_dict(items[0].to_dict())))
15070

I think this is because the items created by pystac-client set the pystac_client.ItemSearch as the root. I haven't figured out the root cause (sorry) yet for why the client objects are so large, but will look more later.

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