python-xarray

Indexing xarray data with variable length DataArray

瘦欲@ 提交于 2020-08-05 10:24:59
问题 I am trying to extract data from xarray dataset using DataArray indexing. My goal is to obtain the data along different line segments overlapping the array. For that I have obtained indices of each of the lines (these are of different sizes based on the length). For example for line 1 : x = [1,2,3], y=[7,8,9] and similarly for line 2 is x=[1,4,5,6,8], y=[0,2,7,9,6] and so on I have some of the lines which are 100x 2. For this I have tried like below : df=xarray_dataset indx=xr.DataArray([[1,2

Indexing xarray data with variable length DataArray

自闭症网瘾萝莉.ら 提交于 2020-08-05 10:23:21
问题 I am trying to extract data from xarray dataset using DataArray indexing. My goal is to obtain the data along different line segments overlapping the array. For that I have obtained indices of each of the lines (these are of different sizes based on the length). For example for line 1 : x = [1,2,3], y=[7,8,9] and similarly for line 2 is x=[1,4,5,6,8], y=[0,2,7,9,6] and so on I have some of the lines which are 100x 2. For this I have tried like below : df=xarray_dataset indx=xr.DataArray([[1,2

Indexing xarray data with variable length DataArray

♀尐吖头ヾ 提交于 2020-08-05 10:23:14
问题 I am trying to extract data from xarray dataset using DataArray indexing. My goal is to obtain the data along different line segments overlapping the array. For that I have obtained indices of each of the lines (these are of different sizes based on the length). For example for line 1 : x = [1,2,3], y=[7,8,9] and similarly for line 2 is x=[1,4,5,6,8], y=[0,2,7,9,6] and so on I have some of the lines which are 100x 2. For this I have tried like below : df=xarray_dataset indx=xr.DataArray([[1,2

Extract interpolated values from a 2D array based on a large set of xy points

不问归期 提交于 2020-07-22 04:55:50
问题 I have a reasonably large 1000 x 4000 pixel xr.DataArray returned from an OpenDataCube query, and a large set (> 200,000) of xy point values. I need to sample the array to return a value under each xy point, and return interpolated values (e.g. if the point lands halfway between a 0 and a 1.0 pixel, the value returned should be 0.5 ). xr.interp lets me easily sample interpolated values, but it returns a huge matrix of every combination of all the x and y values, rather than just the values

Calculate departure or anomaly of a value between two arrays of different geographic grid sizes

隐身守侯 提交于 2020-06-28 03:49:08
问题 I have a technical question, which I tried to solve all week long. I created a netcdf file from observations with a measurement value of air quality on a geographical grid (lat/lon) along a certain track. Now I would like to calculate the departure (or anomaly) of these values from a larger grid (data from a computer model with mean values over a large area). My two netcdf files are structured as follows: Observations (Instrument measurements): Dimensions: lat: 1321, lon: 1321 Data variables:

How to apply a xarray u_function over NetCDF and return a 2D-array (multiple new variables) to the DataSet

99封情书 提交于 2020-05-29 07:42:43
问题 I am trying to use the xarray apply_ufunc to apply a given function f over all pairs of coordinates (i.e. pixels) in the Dataset. The function f returns a 2D array (NxN matrix) as result. Therefore, the resultant Dataset would have several new variables after the analysis: a total of M new variables. The function f does work just fine. So, the error does not seem to be coming from it. A possible problem may the structure that the 2D array is returning from f . As far as I understand, xarray