matlab: splitting small arrays by latitude/longitude into individual grid cells of one large array -


i have multiple satellite orbit paths cover different latitudes/longitudes, bounded same overall lat/lon grid (below). trying split data each orbit path corresponding 0.5x0.5o lat/lon cell of large grid.

for example, i'm looking @ individual satellite orbits cross beaufort sea, total lat/lon boundary below:

lat = [82:-0.5:68];    lon = [-118:-0.5:-160];    

i have 88 orbit files cover different tracks on beaufort sea. latitude, longitude, , data each orbit track stored in separate cells. example 1 orbit path:

lat{16,1} = [68.751 68.749 68.746 68.743 68.740 68.738 68.735 68.732 68.729 68.726];   lon{16,1} = [-118.002 -118.006 -118.009 -118.013 -118.016 -118.020 -118.023    -118.027 -118.030 -118.034]; data{16,1} = [0 0 0 0 0 1 0 0 0 0; 0 0 0 0 1 1 1 1 1 0; 0 0 0 1 1 1 0 0 0 0];   % data stored in height x location   % each 1 cloud, each 0 clear air   

each data array different length because each orbit path crossed different number of locations, has same number of heights. split columns of each data array according corresponding lat/lon , put each data column correct 0.5x0.5o grid cell on beaufort sea. i'd divide number of 'clouds' total number of counts @ each location , average find cloud fraction within each grid cell, can figure out after gridded.

so if grid cell bounded 68.75-68.73on , 118.01-118.03ow, example, data columns 4-8 end in grid cell because lat/lon fall within grid boundary.

any or hints appreciated!

thanks, aaron

assuming want have averages per grid cell, check out this thread on mathcentral.

the outline follows: round coordinates in data positive integer, e.g. round(x/edgelenth-min(x))+1. round makes sure it's integer, edgelength variable can set if want instance half degree cells instead of 1 degree, min(x) shifts origin 0 , +1 makes end @ 1, since matlab cannot work 0 index. can use same y, or lat,lon.

these rounded values can group using sparse(lat,lon,z), z data (i'm assuming heights here). alternatively, if want extract more information, use accumarray, e.g. standard deviations:

datastd = accumarray([lat lon],z,[],@std,[],issparse); 

i'm using technique on data sets containing 800m lat/lon combinations in approximately 5 minutes on grid 0.5m edgelength , 1x1km total size.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -