Commit b79a0d3
authored
fix: deconstruct item collections when writing ndjson (#824)
Closes #823, cc @hrodmn
```sh
$ cargo run -p rustac -- search https://stac.maap-project.org --collections icesat2-boreal-v3.1-agb --max-items 2 -o ndjson
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.19s
Running `target/debug/rustac search 'https://stac.maap-project.org' --collections icesat2-boreal-v3.1-agb --max-items 2 -o ndjson`
{"id":"boreal_agb_2020_202508201755714903_0003300","bbox":[-114.59879925054304,49.48077531986013,-112.85773713759698,50.60188181261153],"type":"Feature","links":[{"rel":"collection","type":"application/json","href":"https://stac.maap-project.org/collections/icesat2-boreal-v3.1-agb"},{"rel":"parent","type":"application/json","href":"https://stac.maap-project.org/collections/icesat2-boreal-v3.1-agb"},{"rel":"root","type":"application/json","href":"https://stac.maap-project.org/"},{"rel":"self","type":"application/geo+json","href":"https://stac.maap-project.org/collections/icesat2-boreal-v3.1-agb/items/boreal_agb_2020_202508201755714903_0003300"}],"assets":{"cog":{"gsd":30,"href":"s3://nasa-maap-data-store/file-staging/nasa-map/icesat2-boreal-v3.1/agb/0003300/boreal_agb_2020_202508201755714903_0003300.tif","type":"image/tiff; application=geotiff; profile=cloud-optimized","bands":[{"name":"mean_agbd","unit":"Mg ha-1","scale":1,"nodata":-9999.0,"offset":0,"sampling":"area","data_type":"float32","histogram":{"max":175.16749572753906,"min":0.6196765899658203,"count":11,"buckets":[7052664,441070,332270,294155,249099,195105,152856,51991,4914,174]},"statistics":{"mean":14.515077559481112,"stddev":27.601881177100985,"maximum":175.16749572753906,"minimum":0.6196765899658203,"valid_percent":97.4922},"spatial_resolution":30},{"name":"std_agbd","unit":"Mg ha-1","scale":1,"nodata":-9999.0,"offset":0,"sampling":"area","data_type":"float32","histogram":{"max":45.995460510253906,"min":0.112965427339077,"count":11,"buckets":[6914058,894421,634985,232124,73201,16131,5837,3247,282,12]},"statistics":{"mean":2.951711920429418,"stddev":4.408658052082873,"maximum":45.995460510253906,"minimum":0.112965427339077,"valid_percent":97.4922},"spatial_resolution":30}],"roles":["data"],"title":"Gridded predictions of aboveground biomass (Mg/ha)","description":"Gridded predictions of aboveground biomass (Mg/ha)","processing:level":"L4"},"training_data_parquet":{"href":"s3://nasa-maap-data-store/file-staging/nasa-map/icesat2-boreal-v3.1/agb/0003300/boreal_agb_2020_202508201755714903_0003300_train.parquet","type":"application/x-parquet","roles":["data"],"title":"Tabular training data","description":"Tabular training data with latitude, longitude, and biomass observations"}},"geometry":{"type":"Polygon","coordinates":[[[-114.59879925054304,50.15253728393152],[-113.90124100268127,49.48077531986013],[-112.85773713759698,49.92391646714159],[-113.54609166427896,50.60188181261153],[-114.59879925054304,50.15253728393152]]]},"collection":"icesat2-boreal-v3.1-agb","properties":{"datetime":"2020-07-01T23:59:59.500000Z","proj:bbox":[3968521.9999999953,3213304.0000000093,4058521.9999999953,3303304.0000000093],"proj:wkt2":"PROJCS[\"unnamed\",GEOGCS[\"GRS 1980(IUGG, 1980)\",DATUM[\"unknown\",SPHEROID[\"GRS80\",6378137,298.257222101],TOWGS84[0,0,0,0,0,0,0]],PRIMEM[\"Greenwich\",0],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]]],PROJECTION[\"Albers_Conic_Equal_Area\"],PARAMETER[\"latitude_of_center\",40],PARAMETER[\"longitude_of_center\",180],PARAMETER[\"standard_parallel_1\",50],PARAMETER[\"standard_parallel_2\",70],PARAMETER[\"false_easting\",0],PARAMETER[\"false_northing\",0],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH]]","proj:shape":[3000,3000],"end_datetime":"2020-12-31T23:59:59Z","proj:geometry":{"type":"Polygon","coordinates":[[[3968521.9999999953,3213304.0000000093],[4058521.9999999953,3213304.0000000093],[4058521.9999999953,3303304.0000000093],[3968521.9999999953,3303304.0000000093],[3968521.9999999953,3213304.0000000093]]]},"proj:transform":[30.0,0.0,3968521.9999999953,0.0,-30.0,3303304.0000000093,0.0,0.0,1.0],"start_datetime":"2020-01-01T00:00:00Z","created_datetime":"2025-08-20T00:00:00+00:00","icesat2-boreal:in_daac":true,"icesat2-boreal:tile_id":"0003300"},"stac_version":"1.1.0","stac_extensions":["https://stac-extensions.github.io/projection/v1.1.0/schema.json"]}
{"id":"boreal_agb_2020_202508201755714861_0000544","bbox":[57.668175458260485,50.00125738393917,59.20217219488729,50.97761041743663],"type":"Feature","links":[{"rel":"collection","type":"application/json","href":"https://stac.maap-project.org/collections/icesat2-boreal-v3.1-agb"},{"rel":"parent","type":"application/json","href":"https://stac.maap-project.org/collections/icesat2-boreal-v3.1-agb"},{"rel":"root","type":"application/json","href":"https://stac.maap-project.org/"},{"rel":"self","type":"application/geo+json","href":"https://stac.maap-project.org/collections/icesat2-boreal-v3.1-agb/items/boreal_agb_2020_202508201755714861_0000544"}],"assets":{"cog":{"gsd":30,"href":"s3://nasa-maap-data-store/file-staging/nasa-map/icesat2-boreal-v3.1/agb/0000544/boreal_agb_2020_202508201755714861_0000544.tif","type":"image/tiff; application=geotiff; profile=cloud-optimized","bands":[{"name":"mean_agbd","unit":"Mg ha-1","scale":1,"nodata":-9999.0,"offset":0,"sampling":"area","data_type":"float32","histogram":{"max":176.0052032470703,"min":0.27263352274894714,"count":11,"buckets":[8785987,16705,5435,2314,1082,567,387,221,68,19]},"statistics":{"mean":0.9879209580172442,"stddev":2.5558262253122197,"maximum":176.0052032470703,"minimum":0.27263352274894714,"valid_percent":97.91983333333332},"spatial_resolution":30},{"name":"std_agbd","unit":"Mg ha-1","scale":1,"nodata":-9999.0,"offset":0,"sampling":"area","data_type":"float32","histogram":{"max":43.77642822265625,"min":0.10243990272283554,"count":11,"buckets":[8747047,39842,13419,6781,2524,1323,907,636,281,25]},"statistics":{"mean":0.44872608375218503,"stddev":1.0205389352986312,"maximum":43.77642822265625,"minimum":0.10243990272283554,"valid_percent":97.91983333333332},"spatial_resolution":30}],"roles":["data"],"title":"Gridded predictions of aboveground biomass (Mg/ha)","description":"Gridded predictions of aboveground biomass (Mg/ha)","processing:level":"L4"},"training_data_parquet":{"href":"s3://nasa-maap-data-store/file-staging/nasa-map/icesat2-boreal-v3.1/agb/0000544/boreal_agb_2020_202508201755714861_0000544_train.parquet","type":"application/x-parquet","roles":["data"],"title":"Tabular training data","description":"Tabular training data with latitude, longitude, and biomass observations"}},"geometry":{"type":"Polygon","coordinates":[[[59.20217219488729,50.19084051082751],[58.912567485634185,50.97761041743663],[57.668175458260485,50.78488521490738],[57.97909409514872,50.00125738393917],[59.20217219488729,50.19084051082751]]]},"collection":"icesat2-boreal-v3.1-agb","properties":{"datetime":"2020-07-01T23:59:59.500000Z","proj:bbox":[-4671478.000000006,6993304.000000009,-4581478.000000006,7083304.000000009],"proj:wkt2":"PROJCS[\"unnamed\",GEOGCS[\"GRS 1980(IUGG, 1980)\",DATUM[\"unknown\",SPHEROID[\"GRS80\",6378137,298.257222101],TOWGS84[0,0,0,0,0,0,0]],PRIMEM[\"Greenwich\",0],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]]],PROJECTION[\"Albers_Conic_Equal_Area\"],PARAMETER[\"latitude_of_center\",40],PARAMETER[\"longitude_of_center\",180],PARAMETER[\"standard_parallel_1\",50],PARAMETER[\"standard_parallel_2\",70],PARAMETER[\"false_easting\",0],PARAMETER[\"false_northing\",0],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH]]","proj:shape":[3000,3000],"end_datetime":"2020-12-31T23:59:59Z","proj:geometry":{"type":"Polygon","coordinates":[[[-4671478.000000006,6993304.000000009],[-4581478.000000006,6993304.000000009],[-4581478.000000006,7083304.000000009],[-4671478.000000006,7083304.000000009],[-4671478.000000006,6993304.000000009]]]},"proj:transform":[30.0,0.0,-4671478.000000006,0.0,-30.0,7083304.000000009,0.0,0.0,1.0],"start_datetime":"2020-01-01T00:00:00Z","created_datetime":"2025-08-20T00:00:00+00:00","icesat2-boreal:in_daac":false,"icesat2-boreal:tile_id":"0000544"},"stac_version":"1.1.0","stac_extensions":["https://stac-extensions.github.io/projection/v1.1.0/schema.json"]}
```1 parent f02dc60 commit b79a0d3
3 files changed
+60
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
556 | 556 | | |
557 | 557 | | |
558 | 558 | | |
559 | | - | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
560 | 562 | | |
561 | 563 | | |
562 | 564 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
9 | 13 | | |
10 | 14 | | |
11 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
112 | 121 | | |
113 | 122 | | |
114 | 123 | | |
| |||
133 | 142 | | |
134 | 143 | | |
135 | 144 | | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
136 | 167 | | |
137 | 168 | | |
138 | 169 | | |
139 | 170 | | |
140 | | - | |
141 | | - | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
142 | 174 | | |
143 | 175 | | |
144 | 176 | | |
| |||
161 | 193 | | |
162 | 194 | | |
163 | 195 | | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
164 | 213 | | |
0 commit comments