home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

7 rows where author_association = "MEMBER" and issue = 377947810 sorted by updated_at descending

✖
✖
✖

✎ View and edit SQL

This data as json, CSV (advanced)

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

user 3

  • max-sixty 3
  • spencerkclark 3
  • jhamman 1

issue 1

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

author_association 1

  • MEMBER · 7 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
460020696 https://github.com/pydata/xarray/issues/2547#issuecomment-460020696 https://api.github.com/repos/pydata/xarray/issues/2547 MDEyOklzc3VlQ29tbWVudDQ2MDAyMDY5Ng== jhamman 2443309 2019-02-03T03:50:47Z 2019-02-03T03:50:47Z MEMBER

@tommylees112 - this issue has sat for a bit of time now. Did you end up with a solution here? If so, is okay with you if we close this out?

{
    "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
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
436422432 https://github.com/pydata/xarray/issues/2547#issuecomment-436422432 https://api.github.com/repos/pydata/xarray/issues/2547 MDEyOklzc3VlQ29tbWVudDQzNjQyMjQzMg== max-sixty 5635139 2018-11-06T21:54:18Z 2018-11-06T21:54:18Z MEMBER

Can you ensure times[0].item() == ds.time[0].item() prior to the reindex? Otherwise the reindex won't find the original index value and will fill with NaNs...

{
    "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
436390574 https://github.com/pydata/xarray/issues/2547#issuecomment-436390574 https://api.github.com/repos/pydata/xarray/issues/2547 MDEyOklzc3VlQ29tbWVudDQzNjM5MDU3NA== max-sixty 5635139 2018-11-06T20:06:54Z 2018-11-06T20:06:54Z MEMBER

Your original value needs to be in the time index in order to remain there after the reindex. Currently it looks like a float value:

Coordinates: * time (time) float64 9.505e+17

If you have a repro example (link in issue template) it's easier to offer help on the whole issue

{
    "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
436336253 https://github.com/pydata/xarray/issues/2547#issuecomment-436336253 https://api.github.com/repos/pydata/xarray/issues/2547 MDEyOklzc3VlQ29tbWVudDQzNjMzNjI1Mw== max-sixty 5635139 2018-11-06T17:23:28Z 2018-11-06T17:23:28Z MEMBER

IIUC, this is actually much easier - reindex on your enlarged times index, and then use ffill. No need for the for loop etc

{
    "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 1599.58ms · About: xarray-datasette
  • Sort ascending
  • Sort descending
  • Facet by this
  • Hide this column
  • Show all columns
  • Show not-blank rows