Staging — geocatalog.staging¶
Copy the remote assets a catalog points at into a local cache, and get
back the same catalog with its paths rewritten to the local copies.
Hand the result to the loaders or to
field_for.
Staging¶
geocatalog.staging.stage(catalog, *, dest=None, assets=None, parallel=8, cache=None, retries=3, on_error='raise')
¶
Resolve every URI in catalog into a local file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
catalog
|
GeoCatalog
|
Catalog whose rows reference remote URIs. Currently
only |
required |
dest
|
PathLike[str] | str | None
|
The cache root when |
None
|
assets
|
list[str] | None
|
When rows carry an asset map (see
|
None
|
parallel
|
int
|
Max concurrent fetches via a
|
8
|
cache
|
LocalCache | None
|
The |
None
|
retries
|
int
|
Per-URI retry budget for transient failures only
(network failures left after the object-store client's own
retries, short reads — the shared policy of
|
3
|
on_error
|
str
|
|
'raise'
|
Returns:
| Type | Description |
|---|---|
GeoCatalog
|
A new |
GeoCatalog
|
|
GeoCatalog
|
(the asset whose URI was the row's |
GeoCatalog
|
its original URI when that asset was not staged. An asset map |
GeoCatalog
|
is rewritten to local paths. The original URIs are kept in |
GeoCatalog
|
the |
GeoCatalog
|
dict keyed like |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
ModuleNotFoundError
|
If a remote URI needs geotoolz-cloud (the
|
Source code in packages/geotoolz-catalog/src/geocatalog/_src/staging/stage.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | |
The cache it fetches into is geocloud.cache.LocalCache.
Object-store pool¶
stage() downloads through geocloud.files on the
stack's one pooled obstore client (the [cloud] extra), with credentials
from geocloud.credentials; the builders read through rasterio / GDAL. To
read the staged or catalogued objects with range requests, take the client
from geocloud.store — one pool per process for the
whole stack.