home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 176693726

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/729#issuecomment-176693726 https://api.github.com/repos/pydata/xarray/issues/729 176693726 MDEyOklzc3VlQ29tbWVudDE3NjY5MzcyNg== 16919188 2016-01-29T11:00:02Z 2016-01-29T11:00:02Z NONE

@mrocklin I have tried your lines, it seemed to work but finally I got the memory error message. However the crash was different than what I used to have...

My dataset is a set of several variables, which are calculated like this :

I have DataArray of unitary data for four rainfall height(0,5,10,15 mm/days,"SYMB") and another DataArray with spatialized rainfall height values ("RAIN").

SYMB <xray.DataArray (Hpluie: 4, time: 203, NIsoSource: 56, Denree: 19, Paliers: 23)> dask.array<xray-Fo..., shape=(4, 203, 56, 19, 23), dtype=float64, chunksize=(4, 50, 10, 19, 5)>

RAIN <xray.DataArray (Paliers: 23, DimK0: 1, DimJ0: 37, DimI0: 15)> dask.array<xray-Ra..., shape=(23, 1, 37, 15), dtype=float64, chunksize=(5, 1, 20, 15)>

Then I created an array which is the result of interpolation between this two arrays The function is :

``` python def interp(array,pluie):

p0 = (array.sel(Hpluie = 5) -array.sel(Hpluie = 0))/5
p1 = (array.sel(Hpluie = 10) -array.sel(Hpluie = 5))/5
p2 = (array.sel(Hpluie = 15) -array.sel(Hpluie = 10))/5

interp = (p0*(pluie.where(pluie<5) - array.Hpluie.sel(Hpluie=5)) +array.sel(Hpluie=5)).fillna(0)\
    +(p1*(pluie.where((pluie>=5) & (pluie<=10)) - array.Hpluie.sel(Hpluie=5)) +array.sel(Hpluie=5)).fillna(0)\
    +(p2*(pluie.where(pluie>10) - array.Hpluie.sel(Hpluie=10)) + array.sel(Hpluie=10)).fillna(0)   
return interp

```

So M = interp(SYMB,RAIN)

M <xray.DataArray (time: 203, NIsoSource: 56, Denree: 19, Paliers: 23, DimK0: 1, DimJ0: 37, DimI0: 15)> dask.array<elemwis..., shape=(203, 56, 19, 23, 1, 37, 15), dtype=float64, chunksize=(50, 10, 19, 5, 1, 20, 15)>

My final variable is the product of this interpolated array and an other spatialized variable("FLUX")

FLUX <xray.DataArray 'Flux_Moyen_Depot_Sec' (Paliers: 23, DimK0: 1, DimJ0: 37, DimI0: 15, NIsoSource: 56)> dask.array<xray-Fl..., shape=(23, 1, 37, 15, 56), dtype=float64, chunksize=(5, 1, 20, 15, 10)>

RES = (M * FLUX).sum("Paliers")

RES = <xray.DataArray (DimK0: 1, DimJ0: 37, DimI0: 15, NIsoSource: 56, time: 203, Denree: 19)> dask.array<p_reduc..., shape=(1, 37, 15, 56, 203, 19), dtype=float64, chunksize=(1, 20, 15, 10, 50, 19

I hope this is at less understandable... thanks a lot for your help

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  129150619
Powered by Datasette · Queries took 0.571ms · About: xarray-datasette