Hi,
I have plotted a bathymetry and now I'm given coastline and some islands files where I need to use them to define where the land is and then turn the land data to NaN.
How should I do that?
Thanks, Eve

댓글 수: 4

Geoff Hayes
Geoff Hayes 2014년 10월 27일
Eve - what is the nature/format of your coastline and islands files? How is this related to your plotted bathymetry data?
eevee
eevee 2014년 10월 28일
Hi Geoff,
I have included my land data in the volume calculation and now my lecturer gave me the xyz files of the land data (i.e. both coastline and islands file). I was asked to use the all those files into my matlab script to tell matlab not to included the land data into the calculation. So, now I do not know how to tell matlab about that. Any ideas?
Thanks,
Eve
Geoff Hayes
Geoff Hayes 2014년 10월 29일
Eve - how do you (currently) calculate the volume? What information do you use for that?
eevee
eevee 2014년 10월 30일
Hi Geoff,
I use:
dx*dy*zi(~isnan(zi))
However, my zi includes both land and sea data. So now, I need to remove the land data before I could calculate the volume of bathymetry. I don't know how to tell matlab that my land data are those that falls below the coastline (please see image below)
Thanks,
Eve

댓글을 달려면 로그인하십시오.

답변 (2개)

Kelly Kearney
Kelly Kearney 2014년 10월 27일

3 개 추천

The inpolygon function will do most of the work. Depending on the scale of your region and the format of the coastlines, you may need to close off polygons, reverse order of vertices, and upsample polygons in order to get the best results; the Mapping Toolbox has several functions ( flatearthpoly, interpm, ispolycw, poly2cw) to help with that.

댓글 수: 6

Chad Greene
Chad Greene 2014년 10월 27일
interpm2 may be used to densify polygons to a given spacing in meters or kilometers.
eevee
eevee 2014년 10월 30일
Hi Chad,
The above image is the bathymetry plot that I've obtained. I was asked to remove the land data (i.e. the data that falls below the coastline) before calculating the volume of my bathymetry.
Any idea how should I do it? I've tried using ginput to select points of an irregular area but I do not know how to proceed from those points selected and making it into an area that I can subtract it from.
Thanks, Eve
Kelly Kearney
Kelly Kearney 2014년 10월 30일
Have you looked at inpolygon, as I suggested?
eevee
eevee 2014년 10월 31일
Hi Kelly,
I have looked into that, but I'm still unsure how should I put it into my script. Could you please advise me?
Please find attached my script.
p/s: i find my volume by vol=dx*dy*sum(zi_diff(~isnan(zi_diff) & zi_diff>=1)); %line 84
However, my lecturer do not want me to use *zi_diff>=1* to define the land data. He wants me to find the indices of xi,yi,and zi_diff that falls under the coordinates of coastline. After that, I sub the indices back into the matrix of xi,yi,zi_diff to get the value before I could calculate the volume of the bathymetry. I'm guessing I need to do a loop for that, but I've been trying and still fail.
Hope to hear from you soon! Really need to get this done!
Thanks, Eve
eevee
eevee 2014년 10월 31일
Hi Kelly,
sorry I just realized I forgot to attach my script. :)
Can you upload the coastline file? The answer will depend on whether it contains just the visible line segments you plotted above, or fully-closed polygons. Assuming it's the latter, your code to mask the land points will look something like:
isin = inpolygon(xi, yi, xcoast, ycoast);
zi_diff(isin) = NaN;
But you may need to do some processing of xcoast and ycoast to convert them to closed, clockwise polygons.

댓글을 달려면 로그인하십시오.

Chad Greene
Chad Greene 2014년 12월 5일

0 개 추천

Another solution is the landmask function on File Exchange.

카테고리

도움말 센터File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

질문:

2014년 10월 27일

답변:

2014년 12월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by