Skip to content

Commit

Permalink
Convert dates to UTC and drop timezone for xarray (#27)
Browse files Browse the repository at this point in the history
Fixes #2
  • Loading branch information
scottyhq authored Apr 22, 2021
1 parent 5d677a4 commit 5ece164
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion stackstac/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ def to_coords(
[item["properties"]["datetime"] for item in items],
infer_datetime_format=True,
errors="coerce",
),
).tz_convert('UTC').tz_localize(None),
"id": xr.Variable("time", [item["id"] for item in items]),
"band": asset_ids,
}
Expand Down
5 changes: 3 additions & 2 deletions stackstac/stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,9 @@ def stack(
xarray DataArray, backed by a Dask array. No IO will happen until calling ``.compute()``,
or accessing ``.values``. The dimensions will be ``("time", "band", "y", "x")``.
``time`` will be equal in length to the number of items you pass in, and indexed by date. Note that this means
multiple entries could have the same index.
``time`` will be equal in length to the number of items you pass in, and indexed by STAC Item datetime.
Note that this means multiple entries could have the same index. Note also datetime strings are cast to
'UTC' but passed to xarray without timezone information (dtype='datetime64[ns]').
``band`` will be equal in length to the number of asset IDs used (see the ``assets`` parameter for more).
Expand Down

0 comments on commit 5ece164

Please sign in to comment.