|
8 | 8 | import pytest |
9 | 9 |
|
10 | 10 | import parcels.tutorial |
11 | | -from parcels import Field, ParticleFile, ParticleSet, XGrid, convert |
| 11 | +from parcels import Field, ParticleFile, ParticleSet, XGrid, convert, open_raw_zarr |
12 | 12 | from parcels._core.fieldset import FieldSet, _datetime_to_msg |
13 | 13 | from parcels._core.model import _default_vector_field_components |
14 | 14 | from parcels._datasets.structured.generic import datasets as datasets_structured |
@@ -420,7 +420,7 @@ def test_fieldset_describe(fieldset_two_models: FieldSet): |
420 | 420 | assert actual == expected |
421 | 421 |
|
422 | 422 |
|
423 | | -def test_fieldset_describe_backends(): |
| 423 | +def test_fieldset_describe_backends(tmp_path): |
424 | 424 | ds_u = parcels.tutorial.open_dataset("NemoNorthSeaORCA025-N006_data/U") |
425 | 425 | ds_v = parcels.tutorial.open_dataset("NemoNorthSeaORCA025-N006_data/V") |
426 | 426 | ds_w = parcels.tutorial.open_dataset("NemoNorthSeaORCA025-N006_data/W") |
@@ -462,6 +462,27 @@ def test_fieldset_describe_backends(): |
462 | 462 | | UV | VectorField | 0 | CGrid_Velocity(...) | - | |
463 | 463 | | UVW | VectorField | 0 | CGrid_Velocity(...) | - | |
464 | 464 |
|
| 465 | +mesh: spherical |
| 466 | +time interval: (np.datetime64('2000-01-02T12:00:00.000000000'), np.datetime64('2000-01-27T12:00:00.000000000')) |
| 467 | +""" |
| 468 | + fieldset.describe(io) |
| 469 | + actual = io.getvalue() |
| 470 | + assert actual == expected |
| 471 | + |
| 472 | + path = tmp_path / "ds.zarr" |
| 473 | + ds_fset.to_zarr(path) |
| 474 | + ds_zarr = open_raw_zarr(path) |
| 475 | + fieldset = FieldSet.from_sgrid_conventions(ds_zarr) |
| 476 | + io = StringIO() |
| 477 | + expected = """\ |
| 478 | +| Name | Type | Grid number | Interp method / value | Parcels backend | |
| 479 | +|:-------|:------------|--------------:|:------------------------|:------------------| |
| 480 | +| U | Field | 0 | XLinear(...) | Zarr | |
| 481 | +| V | Field | 0 | XLinear(...) | Zarr | |
| 482 | +| W | Field | 0 | XLinear(...) | Zarr | |
| 483 | +| UV | VectorField | 0 | CGrid_Velocity(...) | - | |
| 484 | +| UVW | VectorField | 0 | CGrid_Velocity(...) | - | |
| 485 | +
|
465 | 486 | mesh: spherical |
466 | 487 | time interval: (np.datetime64('2000-01-02T12:00:00.000000000'), np.datetime64('2000-01-27T12:00:00.000000000')) |
467 | 488 | """ |
|
0 commit comments