issues: 1812504689
This data as json
id | node_id | number | title | user | state | locked | assignee | milestone | comments | created_at | updated_at | closed_at | author_association | active_lock_reason | draft | pull_request | body | reactions | performed_via_github_app | state_reason | repo | type |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1812504689 | I_kwDOAMm_X85sCKBx | 8006 | Fix documentation about datetime_unit of xarray.DataArray.differentiate | 2448579 | closed | 0 | 0 | 2023-07-19T18:31:10Z | 2023-09-01T09:37:15Z | 2023-09-01T09:37:15Z | MEMBER | Should say that Discussed in https://github.com/pydata/xarray/discussions/8000
<sup>Originally posted by **jesieleo** July 19, 2023</sup>
I have a piece of data that looks like this
```
<xarray.Dataset>
Dimensions: (time: 612, LEV: 15, latitude: 20, longitude: 357)
Coordinates:
* time (time) datetime64[ns] 1960-01-15 1960-02-15 ... 2010-12-15
* LEV (LEV) float64 5.01 15.07 25.28 35.76 ... 149.0 171.4 197.8 229.5
* latitude (latitude) float64 -4.75 -4.25 -3.75 -3.25 ... 3.75 4.25 4.75
* longitude (longitude) float64 114.2 114.8 115.2 115.8 ... 291.2 291.8 292.2
Data variables:
u (time, LEV, latitude, longitude) float32 ...
Attributes: (12/30)
cdm_data_type: Grid
Conventions: COARDS, CF-1.6, ACDD-1.3
creator_email: chepurin@umd.edu
creator_name: APDRC
creator_type: institution
creator_url: https://www.atmos.umd.edu/~ocean/
... ...
standard_name_vocabulary: CF Standard Name Table v29
summary: Simple Ocean Data Assimilation (SODA) soda po...
time_coverage_end: 2010-12-15T00:00:00Z
time_coverage_start: 1983-01-15T00:00:00Z
title: SODA soda pop2.2.4 [TIME][LEV][LAT][LON]
Westernmost_Easting: 118.25
```
when i try to use xarray.DataArray.differentiate
`data.u.differentiate('time',datetime_unit='M')`
will appear
```
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "D:\Anaconda3\lib\site-packages\xarray\core\dataarray.py", line 3609, in differentiate
ds = self._to_temp_dataset().differentiate(coord, edge_order, datetime_unit)
File "D:\Anaconda3\lib\site-packages\xarray\core\dataset.py", line 6372, in differentiate
coord_var = coord_var._to_numeric(datetime_unit=datetime_unit)
File "D:\Anaconda3\lib\site-packages\xarray\core\variable.py", line 2428, in _to_numeric
numeric_array = duck_array_ops.datetime_to_numeric(
File "D:\Anaconda3\lib\site-packages\xarray\core\duck_array_ops.py", line 466, in datetime_to_numeric
array = array / np.timedelta64(1, datetime_unit)
TypeError: Cannot get a common metadata divisor for Numpy datatime metadata [ns] and [M] because they have incompatible nonlinear base time units.
```
Would you please told me is this a BUG? |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/8006/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |