How to create an average vertical profile across a channel from irregular 3d spatial and vertical data

I want to produce an average profile of the variable with height across the cross section of the channel. I'm assuming I need to interpolate this data onto a regular grid but I'm not sure how to go about this...
*EDIT for clarity*
This is an overview of a river channel.
At each node there is a sample of temperature at 20 depth locations - for example 5 metres, 10 metres - though the depths are spaced irregularly as they vary depending on the full depth of the channel at each node.
depthsatnode has the depth at which each measurement has been taken for each node.
temp/salinityatnode is the temperature.salinity value at each depth for each node.
The red box can be considered a volume, that I want to convert into one single cross section for e.g. temperature in the channel.
If you were to look at the cross section in the same overview I posted the box in you would only see a line, as it would then be a single average vertical cross-section across the channel.
---
I also want to do this over time but if it comes to it I'll just create numerous versions of this profile and average the results.
Right now I have
  • xnode (1x54) - (x coordinate of nodes)
  • ynode (1x54) - (y coordinate of nodes)
  • depthsatnode (20x54) - depths of the 20 variables at each of the 54 nodes
  • tempatnode (20x54) - temperature of the 20 heights at each of the 54 nodes
  • sal at node (20x54) - salinity of the 20 heights at each of the 54 nodes

Answers (3)

Can you use scatteredInterpolant and turn it into a 2D array? If so, it's trivial then with the mean() or mean2() function.
You can handle it as three separate 2-D matrices if you want, one for depthsatnode, one for tempatnode, and one for salatnode.

4 Comments

Why does each (x,y) coordinate/node have 20 temperatures at that location? And 20 salinities and 20 depths? Isn't it just one specific (x,y) location?
How are you defining "channel"? Like a color channel, like what Photoshop calls red, green, and blue? So you have 20 temperature channels (images)?
sorry, to clarify:
This is an overview of a river channel.
At each node there is a sample of temperature at 20 depth locations - for example 5 metres, 10 metres - though the depths are nothing like as regular as this and vary depending on the full depth of the channel at each node.
depthsatnode has the depth at which each measurement has been taken for each node.
temp/salinityatnode is the temperature.salinity value at each depth for each node.
The red box can be considered a volume, that I want to convert into one single cross section for e.g. temperature in the channel.
If you were to look at the cross section in the same overview I posted the box in you would only see a line, as it would then be a single average vertical cross-section across the channel.
I still think you need to do scatteredInterpolant. ight need to use interp3() if you can't figure out scatteredInterpolant(). But somehow you need to get this into two regular 3D volumetric arrays. One volumetric array for each of your measurements. After that, it's easy. You have x and y. The z values would be your depths and I'm assuming that every (x,y) pair has 20 z (depth) values associated with it. So you have x, y, and Z and the values are the temps and salinity.
Thank you very much for your advice, I'm looking at interp3 - from the little I've read of scatteredinterp it seems to reduce the 2d/3d dataset to a 2d plane - so removing the data I want to keep?
I'm confused how to use Interp3 when z is not a value, not a vector of values. Do you know how I might code this?

Sign in to comment.

Thankyou. I'm just looking and from what I can see scatteredinterpolant may work on the surface plane i.e. the nodes. I'm not sure if it will preserve the nature of the channel yet as I can't see how it determines which direction to average in - I'd still want to have a cross section of the channel at the end of it.
(Sorry I don't think my question was very clear about the end result I was after. I'm trying to produce a cross section of the channel, so I can see the variable with depth, but I'm averaging in space up and down couple of km and in time to reduce anomalous errors).
It doesn't mention anything about averaging the depth values that go with those nodes? - It seems to depend on x,y,v - which in my case would be the x and y locations of the nodes (v) - but it my case I don't have a single value at that location but the profile of 20 points which is what I'm interested in getting the average for?
what do you think?

Categories

Products

Asked:

on 9 Aug 2014

Answered:

on 2 Oct 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!