@@ -41,80 +41,56 @@ conda install conda-forge::stacrs
4141
4242Then:
4343
44- ``` python 
44+ ``` python  exec="on" source="above"
45+ import  asyncio
4546import  stacrs
4647
47- #  Search a STAC API
48- items =  await  stacrs.search(
49-     " https://landsatlook.usgs.gov/stac-server" 
50-     collections = " landsat-c2l2-sr" 
51-     intersects = {" type" " Point" " coordinates" - 105.119 , 40.173 ]},
52-     sortby = " -properties.datetime" 
53-     max_items = 100 ,
54- )
55- 
56- #  If you installed with `pystac[arrow]`:
57- from  geopandas import  GeoDataFrame
58- 
59- table =  stacrs.to_arrow(items)
60- data_frame =  GeoDataFrame.from_arrow(table)
61- items =  stacrs.from_arrow(data_frame.to_arrow())
62- 
63- #  Write items to a stac-geoparquet file
64- await  stacrs.write(" items.parquet" 
65- 
66- #  Read items from a stac-geoparquet file as an item collection
67- item_collection =  await  stacrs.read(" items.parquet" 
68- 
69- #  You can search geoparquet files using DuckDB
70- #  If you want to search a file on s3, make sure to configure your AWS environment first
71- item_collection =  await  stacrs.search(" s3://bucket/items.parquet" ... )
72- 
73- #  Use `search_to` for better performance if you know you'll be writing the items
74- #  to a file
75- await  stacrs.search_to(
76-     " items.parquet" 
77-     " https://landsatlook.usgs.gov/stac-server" 
78-     collections = " landsat-c2l2-sr" 
79-     intersects = {" type" " Point" " coordinates" - 105.119 , 40.173 ]},
80-     sortby = " -properties.datetime" 
81-     max_items = 100 ,
82- )
48+ async  def  main () -> None :
49+     #  Search a STAC API
50+     items =  await  stacrs.search(
51+         " https://landsatlook.usgs.gov/stac-server" 
52+         collections = " landsat-c2l2-sr" 
53+         intersects = {" type" " Point" " coordinates" - 105.119 , 40.173 ]},
54+         sortby = " -properties.datetime" 
55+         max_items = 100 ,
56+     )
57+ 
58+     #  If you installed with `pystac[arrow]`:
59+     from  geopandas import  GeoDataFrame
60+ 
61+     table =  stacrs.to_arrow(items)
62+     data_frame =  GeoDataFrame.from_arrow(table)
63+     items =  stacrs.from_arrow(data_frame.to_arrow())
64+ 
65+     #  Write items to a stac-geoparquet file
66+     await  stacrs.write(" /tmp/items.parquet" 
67+ 
68+     #  Read items from a stac-geoparquet file as an item collection
69+     item_collection =  await  stacrs.read(" /tmp/items.parquet" 
70+ 
71+     #  Use `search_to` for better performance if you know you'll be writing the items
72+     #  to a file
73+     await  stacrs.search_to(
74+         " /tmp/items.parquet" 
75+         " https://landsatlook.usgs.gov/stac-server" 
76+         collections = " landsat-c2l2-sr" 
77+         intersects = {" type" " Point" " coordinates" - 105.119 , 40.173 ]},
78+         sortby = " -properties.datetime" 
79+         max_items = 100 ,
80+     )
81+ 
82+ asyncio.run(main())
8383``` 
8484
8585See [ the documentation] ( https://stac-utils.github.io/stacrs )  for details.
86- In particular, our [ example notebook ] ( https://stac-utils.github.io/stacrs/latest/example / )  demonstrates  some of the more interesting features.
86+ In particular, our [ examples ] ( https://stac-utils.github.io/stacrs/latest/examples / )  demonstrate  some of the more interesting features.
8787
8888## CLI  
8989
9090** stacrs**  comes with a CLI:
9191
92- ``` shell 
93- $ stacrs -h
94- stacrs: A command-line interface for  the SpatioTemporal Asset Catalog (STAC)
95- 
96- Usage: stacrs [OPTIONS] < COMMAND> 
97- 
98- Commands:
99-   translate  Translates STAC from one format to another
100-   search     Searches a STAC API or stac-geoparquet file
101-   serve      Serves a STAC API
102-   validate   Validates a STAC value
103-   help        Print this message or the help  of the given subcommand(s)
104- 
105- Options:
106-   -i, --input-format < INPUT_FORMAT> 
107-           The input format.
108-       --opt < OPTIONS> 
109-           Options for  getting and putting files from object storage.
110-   -o, --output-format < OUTPUT_FORMAT> 
111-           The output format.
112-   -c, --compact-json < COMPACT_JSON> 
113-           Whether to print compact JSON output [possible values: true, false]
114-       --parquet-compression < PARQUET_COMPRESSION> 
115-           The parquet compression to use when writing stac-geoparquet.
116-   -h, --help
117-           Print help  (see more with ' --help' 
92+ ``` bash  exec="on" source="above" result="text"
93+ stacrs -h
11894``` 
11995
12096>  [ !NOTE] 
0 commit comments