-2

I have two x-array datasets.

  • One is called foo and has the dimensions x,y,time with variables a,b,c,d.
  • The second is called bar and is the result of a time series analysis on foo.
    • this only has dimensions x,y and a single variable e where all values of e fall between 0 and 1.

I would like to use bar to filter or limit the amount of x,y,time data-entries being processed in foo. Only x,y,time's with e > 0.8 at each x.y should be considered here-on.

I'm still fairly new to X-arrays. My question is whether a 'set operation' mentality of somehow AND-ing or intersecting two-xarray datasets and expecting a smaller dataset is a realistic way to reason about x-arrays?

Here is what I have so far.

foo = loadDataset()
bar = perform_timeseries_analysis()
filtered_bar = bar > 0.8
#TODO: Use bar to reduce the size of foo

Conic
  • 998
  • 1
  • 11
  • 26
  • 2
    you should provide us with an example input and a desired ouput. also you should show us what you tried. [see this](http://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples) – Steven G Oct 07 '16 at 17:54
  • The problem with what I've tried is that I've reached a dead end limited by my understanding of X-arrays. What I have encourages people to run with my short sighted thought process to solving this problems. I've tried using .where() and bracket notation filters that give me true or flase values – Conic Oct 07 '16 at 18:00

1 Answers1

-1

Here is what ended up working for me

import numpy as np
from example import *

foo = loadDataset() #returns dataset
bar = perform_timeseries_analysis(foo) # returns dataset
mutable_temp = bar.timeseries.values  
mutable_temp[mutable_temp < 0.8] = np.nan 
mutable_temp[np.isfinite(mutable_temp)] = 0
mask = mutable_temp.astype(np.float32)
foo = foo + mask
Conic
  • 998
  • 1
  • 11
  • 26