Skip to content

Commit

Permalink
Bug in quickstart example. Dimensions names must be explicitely passe…
Browse files Browse the repository at this point in the history
…d to

xarray.DataArray.sel
fixes #11
  • Loading branch information
loicdtx committed Jun 24, 2024
1 parent a4a41b4 commit d82df88
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Instantiating
# load example mask
mask = (data.romania_forest_cover_percentage() > 20).astype('int')
# Instantiate
nrt_class = EWMA(
mask=mask,
Expand Down Expand Up @@ -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')
Expand All @@ -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``.
Expand Down

0 comments on commit d82df88

Please sign in to comment.