home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 392816513

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
392816513 MDU6SXNzdWUzOTI4MTY1MTM= 2623 Why is my export to netcdf command leading to a __truediv__ error? 2014301 closed 0     7 2018-12-19T23:16:14Z 2018-12-24T15:58:03Z 2018-12-24T15:58:03Z NONE      

Code Sample, a copy-pastable example if possible

```python import numpy as np import xarray as xr import glob, os

NCDIR = './output/out/' finalfile = 'summaout.nc'

outfilelist = glob.glob((NCDIR+'/{}.nc').format('basin_*timestep'))

ds=xr.open_mfdataset(outfilelist, concat_dim='hru')

replace = ds['pptrate'] runoff = ds['averageInstantRunoff'].values runoff = np.squeeze(runoffdata, axis=2) runoff = runoff.transpose() replace.values = runoff

ncconvert = ds.drop('averageInstantRunoff') runoffarray = xr.DataArray(runoff, dims=['time','hru']) ds['averageInstantRunoff'] = runoffarray ds.to_netcdf('test.nc')

```

Problem description

This is ds just before export. <xarray.Dataset> Dimensions: (hru: 17, time: 233) Coordinates: * hru (hru) int64 9 17 11 8 3 2 6 4 7 12 1 13 10 16 15 5 14 * time (time) datetime64[ns] 2010-01-01 ... 2010-01-30 Data variables: pptrate (time, hru) float64 9.241e-05 9.241e-05 ... 2.717e-09 hruId (hru) int64 dask.array<shape=(17,), chunksize=(1,)> averageInstantRunoff (time, hru) float64 9.241e-05 9.241e-05 ... 2.717e-09 nSnow (time, hru) int32 dask.array<shape=(233, 17), chunksize=(233, 1)> nSoil (time, hru) int32 dask.array<shape=(233, 17), chunksize=(233, 1)> nLayers (time, hru) int32 dask.array<shape=(233, 17), chunksize=(233, 1)> I get this error message:

TypeError: cannot perform __truediv__ with this index type: <class 'pandas.core.indexes.datetimes.DatetimeIndex'>

Expected Output

netCDF

Output of xr.show_versions()

INSTALLED VERSIONS ------------------ commit: None python: 3.6.4.final.0 python-bits: 64 OS: Linux OS-release: 3.12.62-60.64.8-default machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: en_US.UTF-8 xarray: 0.11.0 pandas: 0.21.0 numpy: 1.13.3 scipy: 1.0.0 netCDF4: 1.4.0 h5netcdf: 0.5.0 h5py: 2.7.1 Nio: None zarr: None cftime: 1.0.0 PseudonetCDF: None rasterio: None iris: None bottleneck: 1.2.1 cyordereddict: None dask: 0.19.3 distributed: 1.23.3 matplotlib: 2.1.2 cartopy: 0.15.1 seaborn: 0.9.0 setuptools: 36.7.2 pip: 18.1 conda: 4.5.11 pytest: 3.2.5 IPython: 6.2.1 sphinx: 1.6.5
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/2623/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed 13221727 issue

Links from other tables

  • 1 row from issues_id in issues_labels
  • 7 rows from issue in issue_comments
Powered by Datasette · Queries took 0.633ms · About: xarray-datasette