home / github

Menu
  • GraphQL API
  • Search all tables

issues

Table actions
  • GraphQL API for issues

1 row where state = "closed" and user = 35741277 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date), updated_at (date), closed_at (date)

type 1

  • issue 1

state 1

  • closed · 1 ✖

repo 1

  • xarray 1
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
1371711272 I_kwDOAMm_X85Rwqco 7029 Writing datarray/dataset to netcdf results in bad values etsmith14 35741277 closed 0     1 2022-09-13T16:25:31Z 2022-09-14T17:04:16Z 2022-09-14T17:04:16Z NONE      

What is your issue?

I am trying to save a regional subset of a netcdf file as netcdf file. I am first opening some data with dimensions of time, latitude, and longitude and then slicing that data by latitude and longitude to produce a smaller subset of the data. I save that smaller subset with the to_netcdf command. But when I go to open the new netcdf, the timeseries definitely wrong (see figures). The figure named 'correct' is what the temperature timeseries looks like when plotting directly from the original dataset. The figure named 'wrong' is what the temperature timeseries looks like when plotting from the newly saved netcdf (hopefully both figures attached properly). This happens when I select just a single point and save the data as a netcdf and it also happens when I save as a zarr file. However, when I load a single netcdf with open_dataset (instead of open_mfdataset) and save it as a new netcdf, everything is correct. So the issue seems to be coming from open_mfdataset. I've also noticed that not all grid points are incorrect, only some grid points have this issue. This doesn't happen when I convert to a series then save as a CSV, just happens when saving as a netcdf or zarr.

`import xarray as xr import matplotlib.pyplot as plt

lats = [33.35] lons = [-112.86]

Load data from original files

ERA5_t2m = xr.open_mfdataset(r'E:\ERA5\Temperature\T2m_*' + '.nc', parallel=True).sel(latitude = slice(37.25,31), longitude = slice(-115, -109))

plot original data (looks good)

plt.plot((((ERA5_t2m.t2m.sel(latitude = lats[0], longitude = lons[0], method='nearest')- 273.15) * 9/5) + 32))

save regional subset as new netcdf

ERA5_t2m.t2m.to_netcdf(r"E:\Arizona_test\Arizona_Temperature.nc")

open new netcdf regional subset

ERA5_t2m_AZ = xr.open_dataset(r'E:\Arizona_test\Arizona_Temperature.nc')

plot same point from new netcdf (looks bad)

plt.plot((((ERA5_t2m_AZ.t2m.sel(latitude = lats[0], longitude = lons[0], method='nearest')- 273.15) * 9/5) + 32))`

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/7029/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issues] (
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [number] INTEGER,
   [title] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [state] TEXT,
   [locked] INTEGER,
   [assignee] INTEGER REFERENCES [users]([id]),
   [milestone] INTEGER REFERENCES [milestones]([id]),
   [comments] INTEGER,
   [created_at] TEXT,
   [updated_at] TEXT,
   [closed_at] TEXT,
   [author_association] TEXT,
   [active_lock_reason] TEXT,
   [draft] INTEGER,
   [pull_request] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [state_reason] TEXT,
   [repo] INTEGER REFERENCES [repos]([id]),
   [type] TEXT
);
CREATE INDEX [idx_issues_repo]
    ON [issues] ([repo]);
CREATE INDEX [idx_issues_milestone]
    ON [issues] ([milestone]);
CREATE INDEX [idx_issues_assignee]
    ON [issues] ([assignee]);
CREATE INDEX [idx_issues_user]
    ON [issues] ([user]);
Powered by Datasette · Queries took 20.559ms · About: xarray-datasette