home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 159222357

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
159222357 MDU6SXNzdWUxNTkyMjIzNTc= 877 Bug in multiplying datasets? Removes coordinates for lats 9618134 closed 0     4 2016-06-08T17:10:52Z 2016-06-08T18:31:14Z 2016-06-08T18:31:14Z NONE      

I wasn't sure if this should go on the googlegroup or here, but the xarray docs says bugs go here so here it is.

I am doing a very simple operation. I have two netcdf files that I load in and then multiply. First:

``` Python import xarray as xr ncscd='NCSCDv2_Circumpolar_WGS84_SOCC30_05deg.nc' ncscddata30 = xr.open_dataset(ncscd) ncscd_d30cm = ncscddata30['NCSCDv2'].load() print ncscd_d30cm

xarray.DataArray 'NCSCDv2' (lat: 111, lon: 720) array([[ nan, nan, nan, ..., nan, nan, nan], [ nan, nan, nan, ..., nan, nan, nan], [ nan, nan, nan, ..., nan, nan, nan], ..., [ nan, nan, nan, ..., nan, nan, nan], [ nan, nan, nan, ..., nan, nan, nan], [ nan, nan, nan, ..., nan, nan, nan]]) Coordinates: * lon (lon) float64 -179.7 -179.2 -178.7 -178.2 -177.7 -177.2 -176.7 ... * lat (lat) float64 89.75 89.25 88.75 88.25 87.75 87.25 86.75 86.25 ... Attributes: long_name: NCSCDv2 esri_pe_string: GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]] units: Degree ```

And then the second:

``` Python gridfile ='NCSCDv2_gridarea.nc' gridarea = xr.open_dataset(gridfile).load() print gridarea

xarray.Dataset Dimensions: (lat: 111, lon: 720) Coordinates: * lon (lon) float64 -179.7 -179.2 -178.7 -178.2 -177.7 -177.2 ... * lat (lat) float64 89.75 89.25 88.75 88.25 87.75 87.25 86.75 86.25 ... Data variables: cell_area (lat, lon) float64 1.337e+07 1.337e+07 1.337e+07 1.337e+07 ... Attributes: CDI: Climate Data Interface version 1.6.8 (http://mpimet.mpg.de/cdi) Conventions: CF-1.4 history: Mon May 16 18:13:43 2016: cdo gridarea NCSCDv2_Circumpolar_WGS84_SOCC100_05deg.nc NCSCDv2_gridarea.nc CDO: Climate Data Operators version 1.6.8rc2 (http://mpimet.mpg.de/cdo) ```

Both arrays are the same size. Now I simply multiply them together but note that lats in the output are now 0.

``` Python ncscd_total30cm = gridarea.cell_area * ncscd_d30cm print ncscd_total30cm

xarray.Dataset Dimensions: (lat: 0, lon: 720) Coordinates: * lat (lat) float64 * lon (lon) float64 -179.7 -179.2 -178.7 -178.2 -177.7 -177.2 ... Data variables: cell_area (lat, lon) float64 Attributes: CDI: Climate Data Interface version 1.6.8 (http://mpimet.mpg.de/cdi) Conventions: CF-1.4 history: Mon May 16 18:13:43 2016: cdo gridarea NCSCDv2_Circumpolar_WGS84_SOCC100_05deg.nc NCSCDv2_gridarea.nc CDO: Climate Data Operators version 1.6.8rc2 (http://mpimet.mpg.de/cdo) ```

This doesn't seem like it should be happening. Removing the .load() doesn't help. Bug?

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/877/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
  • 4 rows from issue in issue_comments
Powered by Datasette · Queries took 158.703ms · About: xarray-datasette