Python API reference
xcube_multistore.multistore.MultiSourceDataStore
Manages access to multiple data sources and their configurations for generating data cubes.
This class utilizes xcube data store plugins for data access, supports data harmonization, and enables visualization of data cube generation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
str | dict[str, Any]
|
Configuration settings, provided as a dictionary or a string reference to a YAML configuration file. |
required |
Notes
Detailed instructions on setting up the configuration can be found in the Configuration Guide.
Source code in xcube_multistore/multistore.py
49 50 51 52 53 54 55 56 57 58 59 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 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 |
|
get_config_schema()
classmethod
Retrieves the configuration schema for the multi-source data store.
Returns:
Type | Description |
---|---|
JsonObjectSchema
|
A schema object defining the expected structure of the configuration. |
Source code in xcube_multistore/multistore.py
91 92 93 94 95 96 97 98 |
|
xcube_multistore.utils.prepare_dataset_for_netcdf(ds)
Prepares an xarray Dataset for NetCDF serialization.
Converts non-serializable attributes (lists, tuples, and dictionaries) into strings to ensure compatibility with NetCDF format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ds
|
Dataset
|
The input xarray Dataset. |
required |
Returns:
Type | Description |
---|---|
Dataset
|
A dataset with updated attributes, ensuring compatibility with NetCDF. |
Source code in xcube_multistore/utils.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
|
xcube_multistore.utils.get_utm_zone(lat, lon)
Determines the UTM (Universal Transverse Mercator) zone for given coordinates.
Computes the UTM zone based on longitude and returns the corresponding EPSG code. Northern hemisphere zones use EPSG codes in the 32600 range, while southern hemisphere zones use EPSG codes in the 32700 range.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lat
|
float
|
Latitude in degrees. |
required |
lon
|
float
|
Longitude in degrees. |
required |
Returns:
Type | Description |
---|---|
str
|
The EPSG code for the corresponding UTM zone (e.g., "epsg:32633"). |
Source code in xcube_multistore/utils.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
|
xcube_multistore.utils.get_bbox(lat, lon, cube_width, crs_final='utm')
Generates a bounding box around a specified latitude and longitude.
Given a point (latitude, longitude) and the desired width of a cube, this function computes the bounding box in the specified coordinate reference system (CRS). The bounding box is returned as a list of coordinates, and the CRS is returned as well.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lat
|
float
|
Latitude of the central point in degrees. |
required |
lon
|
float
|
Longitude of the central point in degrees. |
required |
cube_width
|
float
|
The width of the cube in units of crs_final, used to define the extent of the bounding box. |
required |
crs_final
|
CRS or str
|
The target CRS for the bounding box. Defaults to "utm", which automatically determines the UTM zone based on the latitude and longitude. |
'utm'
|
Returns:
Type | Description |
---|---|
(list[int], CRS)
|
A list of four integers representing the bounding box in the format [west, south, east, north]. |
(list[int], CRS)
|
The final CRS used for the bounding box, returned as a |
Source code in xcube_multistore/utils.py
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 |
|
xcube_multistore.utils.clean_dataset(ds)
Cleans an xarray Dataset by removing boundary variables and normalizing the grid mapping.
This function removes specific variables related to bounds (e.g., "x_bnds", "y_bnds", "lat_bnds", "lon_bnds", "time_bnds") and normalizes the grid mapping by adding a spatial reference coordinate called "spatial_ref" and assigning it to the relevant data variables.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ds
|
Dataset
|
The input xarray dataset to be cleaned. |
required |
Returns:
Type | Description |
---|---|
Dataset
|
A cleaned version of the dataset with boundary variables removed and grid |
Dataset
|
mapping normalized. |
Source code in xcube_multistore/utils.py
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
|