Skip to content

Commit edd7a49

Browse files
authored
docs: describe formats (#75)
Closes #74, cc @scottyhq
1 parent e71a9e2 commit edd7a49

File tree

8 files changed

+55
-546210
lines changed

8 files changed

+55
-546210
lines changed

docs/.markdownlint-cli2.jsonc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"config": { "reference-links-images": false }
3+
}

docs/api/index.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,25 @@ description: The stacrs Python API
55
# Python API
66

77
API documentation for the **stacrs** Python package.
8+
9+
## Format
10+
11+
Several functions, including [stacrs.write][], take a `format` argument.
12+
Valid values are:
13+
14+
- `json` or `geojson`: compact (no whitespace) JSON
15+
- `json-pretty` or `geojson-pretty`: indented JSON
16+
- `ndjson`: newline-delimited JSON (also known as `geojson-seq`)
17+
- `parquet` or `geoparquet`: uncompressed geoparquet
18+
- `parquet[{compression}]` or `geoparquet[{compression}]`: compressed parquet, where valid values for `compression` are the lowercase string versions of the values enumerated in [stac::geoparquet::Compression](https://docs.rs/stac/latest/stac/geoparquet/enum.Compression.html).
19+
20+
!!! tip
21+
22+
If you're not sure which geoparquet compression to use, we suggest `parquet[snappy]`
23+
24+
!!! note
25+
26+
The distinction between pretty and compact JSON, or compressed and uncompressed geoparquet, is only relevant on write.
27+
On read, the formats are treated the same.
28+
29+
Under the hood, the `format` argument is parsed into a [Format](https://docs.rs/stac/latest/stac/enum.Format.html) enum.

docs/api/walk.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Walk
2+
3+
::: stacrs.walk

docs/example.ipynb

Lines changed: 15 additions & 546209 deletions
Large diffs are not rendered by default.

mkdocs.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ nav:
2626
- read: api/read.md
2727
- search: api/search.md
2828
- version: api/version.md
29+
- walk: api/walk.md
2930
- write: api/write.md
3031
- CONTRIBUTING.md
3132

@@ -48,7 +49,7 @@ plugins:
4849
show_source: false
4950
show_symbol_type_toc: true
5051
signature_crossrefs: true
51-
import:
52+
inventories:
5253
- https://kylebarron.dev/arro3/latest/objects.inv
5354
- search
5455
- social:

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ dev = [
6060
docs = [
6161
"contextily>=1.6.2",
6262
"humanize>=4.12.1",
63+
"ipykernel>=6.29.5",
6364
"jinja2>=3.1.4",
6465
"mike>=2.1.3",
6566
"mkdocs-jupyter>=0.25.1",

tests/test_write.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,10 @@ async def test_write(item: dict[str, Any], tmp_path: Path) -> None:
1212
table = pyarrow.parquet.read_table(path)
1313
items = list(stac_geoparquet.arrow.stac_table_to_items(table))
1414
assert len(items) == 1
15+
16+
17+
async def test_write_compressed(item: dict[str, Any], tmp_path: Path) -> None:
18+
path = str(tmp_path / "out.parquet")
19+
await stacrs.write(path, [item], format="parquet[snappy]")
20+
metadata = pyarrow.parquet.read_metadata(path)
21+
assert metadata.row_group(0).column(0).compression == "SNAPPY"

uv.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)