home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

3 rows where issue = 377947810 and user = 6628425 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

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

user 1

  • spencerkclark · 3 ✖

issue 1

  • How do I copy my array forwards in time? · 3 ✖

author_association 1

  • MEMBER 3
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
436695050 https://github.com/pydata/xarray/issues/2547#issuecomment-436695050 https://api.github.com/repos/pydata/xarray/issues/2547 MDEyOklzc3VlQ29tbWVudDQzNjY5NTA1MA== spencerkclark 6628425 2018-11-07T16:53:14Z 2018-11-07T16:53:14Z MEMBER

The _FillValue encoding seems to be preserved with your desired value in my example: ``` $ ncdump -h result.nc netcdf result { dimensions: time = 366 ; y = 200 ; x = 200 ; variables: int64 time(time) ; time:units = "days since 2000-01-01 00:00:00" ; time:calendar = "proleptic_gregorian" ; short Rg(time, y, x) ; Rg:_FillValue = -1s ; Rg:long_name = "HWSD sub sum content" ; Rg:units = "percent wt" ; Rg:valid_range = 97., 103. ; double latitude(y, x) ; latitude:_FillValue = -99999. ; double longitude(y, x) ; longitude:_FillValue = -99999. ;

// global attributes: :Conventions = "CF-1.0" ; :content = "HARMONIZED WORLD SOIL DATABASE; first it was aggregated to one global file; then the missing areas were filled with interpolated data; then separate tiles were extracted" ; :scaling_factor = "20" ; ``` Is the time encoding important for your land surface model? That does change in my example (see the units attribute); you might need some special logic to handle that.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  How do I copy my array forwards in time? 377947810
436679811 https://github.com/pydata/xarray/issues/2547#issuecomment-436679811 https://api.github.com/repos/pydata/xarray/issues/2547 MDEyOklzc3VlQ29tbWVudDQzNjY3OTgxMQ== spencerkclark 6628425 2018-11-07T16:14:27Z 2018-11-07T16:14:27Z MEMBER

Thanks @tommylees112 -- note that the reindex and ffill methods do not operate in-place, so you'll need to assign the results of them to new variables. You can also do them all in one step: ``` In [1]: import xarray as xr; import pandas as pd; import numpy as np

In [2]: ds = xr.open_dataset('Rg_dummy.nc')

In [3]: times = pd.date_range("2000-01-01", "2000-12-31", name="time")

In [4]: ds['time'] = np.array([times[0]])

In [5]: ds2 = ds.reindex(time=times, method='ffill')

In [6]: ds2.to_netcdf('result.nc') ``` Regarding the issue saving to files -- I can reproduce that issue with older xarray versions. It is related to

2512 and was fixed in #2513 (i.e. it works with the master version of xarray). The good news is this bug only applies to saving ds in my example, not ds2, so you should be able to do this with your current setup just fine.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  How do I copy my array forwards in time? 377947810
436638944 https://github.com/pydata/xarray/issues/2547#issuecomment-436638944 https://api.github.com/repos/pydata/xarray/issues/2547 MDEyOklzc3VlQ29tbWVudDQzNjYzODk0NA== spencerkclark 6628425 2018-11-07T14:23:42Z 2018-11-07T14:23:42Z MEMBER

@tommylees112 I had a look at your dataset and noticed that the time coordinate was not encoded in a way that allows xarray to automatically decode the time values into datetimes. Specifically, the units attribute is not in the format of some unit of time (e.g. 'seconds') since a given reference date. ``` $ ncdump -h Rg_dummy.nc netcdf Rg_dummy { dimensions: time = 1 ; y = 200 ; x = 200 ; variables: double time(time) ; time:_FillValue = NaN ; time:standard_name = "time" ; time:units = "day as %Y%m%d.%f" ; time:calendar = "proleptic_gregorian" ; short Rg(time, y, x) ; Rg:_FillValue = -1s ; Rg:long_name = "HWSD sub sum content" ; Rg:units = "percent wt" ; Rg:valid_range = 97., 103. ; double latitude(y, x) ; latitude:_FillValue = -99999. ; double longitude(y, x) ; longitude:_FillValue = -99999. ;

// global attributes: :Conventions = "CF-1.0" ; :content = "HARMONIZED WORLD SOIL DATABASE; first it was aggregated to one global file; then the missing areas were filled with interpolated data; then separate tiles were extracted" ; :scaling_factor = "20" ; } `` This is whyds.time` is an array of floats when you load the file in. We could discuss how to address that, but depending on your broader needs here that might not be a major concern.

Regarding assigning a new value to the time coordinate, the following should work: python ds['time'] = np.array([times[0]])

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  How do I copy my array forwards in time? 377947810

Advanced export

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

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
);
CREATE INDEX [idx_issue_comments_issue]
    ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
    ON [issue_comments] ([user]);
Powered by Datasette · Queries took 28.568ms · About: xarray-datasette