def test_zarr_source_1(): source = load_source( "zarr-s3", f"{S3_URL}/0.1.20/zarr/mini-rt-20200102.zarr", ) ds = source.to_xarray() assert len(ds.forecast_time) == 1
def test_zarr_source_3(): import datetime import numpy as np from climetlab.utils.dates import to_datetime_list source = load_source( "zarr-s3", [ f"{S3_URL}/0.1.20/zarr/mini-hc-20200109.zarr", f"{S3_URL}/0.1.20/zarr/mini-hc-20200102.zarr", ], ) ds = source.to_xarray() assert len(ds.forecast_time) == 8 dates = to_datetime_list(ds.forecast_time) assert dates[0] == datetime.datetime(2000, 1, 2) assert dates[1] == datetime.datetime(2000, 1, 9) assert dates[2] == datetime.datetime(2001, 1, 2) assert dates[3] == datetime.datetime(2001, 1, 9) dates = to_datetime_list(ds.forecast_time.values) assert dates[0] == datetime.datetime(2000, 1, 2) assert dates[1] == datetime.datetime(2000, 1, 9) assert dates[2] == datetime.datetime(2001, 1, 2) assert dates[3] == datetime.datetime(2001, 1, 9)
def test_zarr_source_2(): import datetime from climetlab.utils.dates import to_datetime_list source = load_source( "zarr-s3", [ f"{S3_URL}/zarr/mini-rt-20200109.zarr", f"{S3_URL}/zarr/mini-rt-20200102.zarr", ], ) ds = source.to_xarray() assert len(ds.forecast_time) == 2 dates = to_datetime_list(ds.forecast_time) assert dates[0] == datetime.datetime(2020, 1, 2) assert dates[1] == datetime.datetime(2020, 1, 9) dates = to_datetime_list(ds.forecast_time.values) assert dates[0] == datetime.datetime(2020, 1, 2) assert dates[1] == datetime.datetime(2020, 1, 9)