You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"As with a static catalog the `get_collections` function will iterate through the Collections in the Catalog. Notice that because this is an API it can get all the Collections through a single call, rather than having to fetch each one individually."
64
+
]
35
65
},
36
66
{
37
67
"cell_type": "code",
38
68
"execution_count": null,
39
-
"source": [
40
-
"cat = Client.open(CMR_URL, headers=headers)"
41
-
],
69
+
"id": "bb7693fb",
70
+
"metadata": {},
42
71
"outputs": [],
43
-
"metadata": {}
72
+
"source": [
73
+
"for collection in cat.get_collections():\n",
74
+
" print(collection)"
75
+
]
44
76
},
45
77
{
46
78
"cell_type": "code",
47
79
"execution_count": null,
48
-
"source": [
49
-
"print(cat)"
50
-
],
80
+
"id": "fef20a46",
81
+
"metadata": {},
51
82
"outputs": [],
52
-
"metadata": {}
83
+
"source": [
84
+
"collection = cat.get_collection('aster-l1t')\n",
85
+
"collection"
86
+
]
87
+
},
88
+
{
89
+
"cell_type": "markdown",
90
+
"id": "47a540fe",
91
+
"metadata": {},
92
+
"source": [
93
+
"# Items\n",
94
+
"\n",
95
+
"The main functions for getting items return iterators, where pystac-client will handle retrieval of additional pages when needed. Note that one request is made for the first ten items, then a second request for the next ten."
96
+
]
53
97
},
54
98
{
55
99
"cell_type": "code",
56
100
"execution_count": null,
57
-
"source": [
58
-
"for kitten in cat.get_children():\n",
59
-
" print(kitten)"
60
-
],
101
+
"id": "17d6de4b",
102
+
"metadata": {},
61
103
"outputs": [],
62
-
"metadata": {}
104
+
"source": [
105
+
"items = collection.get_items()\n",
106
+
"\n",
107
+
"# flush stdout so we can see the exact order that things happen\n",
108
+
"def get_ten_items(items):\n",
109
+
" for i, item in enumerate(items):\n",
110
+
" print(f\"{i}: {item}\", flush=True)\n",
111
+
" if i == 9:\n",
112
+
" return\n",
113
+
"\n",
114
+
"print('First page', flush=True)\n",
115
+
"get_ten_items(items)\n",
116
+
"\n",
117
+
"print('Second page', flush=True)\n",
118
+
"get_ten_items(items)"
119
+
]
120
+
},
121
+
{
122
+
"cell_type": "markdown",
123
+
"id": "62e26114",
124
+
"metadata": {},
125
+
"source": [
126
+
"# API Search\n",
127
+
"\n",
128
+
"If the Catalog is an API, we have the ability to search for items based on spatio-temporal properties."
0 commit comments