Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Sometimes you want to work with a large set of data from EarthScope’s API(s), but want to store it locally so you don’t have to download it repeatedly.

One powerful way to download and store that data is using PyArrow Datasets.

In this example, we use the SDK to download larger-than-memory data and store it in hive-partitioned parquet on our local filesystem. At that point, we can use myriad tools to interact with the “dataset.”

First, plan the entire desired dataset and (optionally) group &/ sort the query plan to control execution order.

AsyncGnssObservationsQueryPlan(requests=42, groups=7)

Next, define your desired partitioning schema.

The following partition scheme will produce a directory structure like:

  • /year=<year>/month=<month>/day=<day>/000000-0.parquet

Finally, we are ready to iterate over our QueryPlan in smaller-than-memory batches, writing each batch to disk before retrieving the next batch.

Table size: 5,086,146 rows, uncompressed size 240.42 MB
Table size: 5,085,276 rows, uncompressed size 237.39 MB
Table size: 5,048,954 rows, uncompressed size 238.21 MB
Table size: 5,070,092 rows, uncompressed size 236.06 MB
Table size: 5,099,502 rows, uncompressed size 240.94 MB
Table size: 5,041,887 rows, uncompressed size 237.13 MB
Table size: 5,016,814 rows, uncompressed size 235.71 MB

This final cell just lists the contents of the output directory.

data/my_dataset/year=2025/month=7/day=20/000000-0.parquet - 99.62 MB
data/my_dataset/year=2025/month=7/day=21/000001-0.parquet - 99.60 MB
data/my_dataset/year=2025/month=7/day=22/000002-0.parquet - 98.54 MB
data/my_dataset/year=2025/month=7/day=23/000003-0.parquet - 99.26 MB
data/my_dataset/year=2025/month=7/day=24/000004-0.parquet - 99.86 MB
data/my_dataset/year=2025/month=7/day=25/000005-0.parquet - 98.55 MB
data/my_dataset/year=2025/month=7/day=26/000006-0.parquet - 98.04 MB