Store dataset contents to a backends.*DataStore object.
(
dataset, store, writer=None, encoder=None, encoding=None, unlimited_dims=None
)
| 467 | |
| 468 | |
| 469 | def dump_to_store( |
| 470 | dataset, store, writer=None, encoder=None, encoding=None, unlimited_dims=None |
| 471 | ): |
| 472 | """Store dataset contents to a backends.*DataStore object.""" |
| 473 | if writer is None: |
| 474 | writer = ArrayWriter() |
| 475 | |
| 476 | if encoding is None: |
| 477 | encoding = {} |
| 478 | |
| 479 | variables, attrs = conventions.encode_dataset_coordinates(dataset) |
| 480 | |
| 481 | check_encoding = set() |
| 482 | for k, enc in encoding.items(): |
| 483 | # no need to shallow copy the variable again; that already happened |
| 484 | # in encode_dataset_coordinates |
| 485 | variables[k].encoding = enc |
| 486 | check_encoding.add(k) |
| 487 | |
| 488 | if encoder: |
| 489 | variables, attrs = encoder(variables, attrs) |
| 490 | |
| 491 | store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims) |
| 492 | |
| 493 | |
| 494 | def save_mfdataset( |
no test coverage detected
searching dependent graphs…