From d82df889eb202451a1e83a0ba74d2098c34ad09d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Dutrieux?= Date: Mon, 24 Jun 2024 11:38:52 +0200 Subject: [PATCH] Bug in quickstart example. Dimensions names must be explicitely passed to xarray.DataArray.sel fixes #11 --- docs/quickstart.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/quickstart.rst b/docs/quickstart.rst index a237f36..446c91a 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -41,7 +41,7 @@ Instantiating # load example mask mask = (data.romania_forest_cover_percentage() > 20).astype('int') - + # Instantiate nrt_class = EWMA( mask=mask, @@ -72,12 +72,12 @@ Fitting # load example xarray s2_cube = data.romania_20m() - history = s2_cube.B3.sel(slice(None, '2019-01-01')) - monitor = s2_cube.B3.sel(slice('2019-01-01', None)) - + history = s2_cube.B3.sel(time=slice(None, '2019-01-01')) + monitor = s2_cube.B3.sel(time=slice('2019-01-01', None)) + # Fitting nrt_class.fit(dataarray=history) - + # Dump model nrt_class.to_netcdf('model.nc') @@ -97,14 +97,14 @@ Monitoring # Load dumped model nrt_class = EWMA.from_netcdf('model.nc') - + # Monitor new observations for array, date in zip(monitor.values, monitor.time.values.astype('datetime64[s]').tolist()): nrt_class.monitor(array=array, date=date) # Report results nrt_class.report('report.tif') - + If the model was dumped to a NetCDF it can be read from disk with ``from_netcdf()``. Monitoring happens with ``.monitor()``. This only takes an numpy array and a date of class ``datetime.date``.