Thursday 6 February 2014

Create Bathymetry Map in Matlab from xyz Data

Thursday 6 February 2014 | by Riza | , | 41 comments

Matlab is a high-level computing language. There are many purpose using this program. In this post, I will describe how to make bathymetry map from xyz data in Matlab. Main idea of the process is only make x data, y data and z data to be a grid because of use surf command, so simple.

OK lets start .....

Before make a Matlab script, you must have xyz data, as an example I use data from  ETOPO 1 National Geophysical Data Center (NGDC) NOAA, you can download here. Select your area of interest and choose xyz data as an output format.

Steps in Matlab :

  • Load your xyz data.
  • x data is longitude, y data is latitude and z data is depth.
  • Use unique command for x data and y data.
lon = unique(yourdata(:,1));
lat = unique(yourdata(:,2));
  • Make a grid from lon and lat data
[LAT LON]=meshgrid(lat,lon);
  • Make z data as a grid using this command.
for n=1:length(yourdata)
   ilon = find(lon==yourdata(n,1));
   ilat = find(lat==yourdata(n,2));
   depth(ilon,ilat) = yourdata(n,3);
end
  • Use surf command.
surf(LON,LAT,depth);
shading interp;
  • Run your matlab script.
This is example of resulting display

Bathymetry Map of England


Bathymetry Map of Indonesia


Bathymetry Map of Japan




41 comments:

  1. How do you make that colorbar?

    ReplyDelete
    Replies
    1. The ones for England and Indo?

      Delete
    2. I will give you the script and colorbar, please send me your e-mail.

      Delete
    3. Hi! Riza,

      Your plots are very impressive. Would you please send me the script for making these bathymetric plots? My email is una146@gmail.com. Thanks in advance!

      Delete
    4. Hi! Riza,

      Your plots are very impressive. Would you please send me the script for making these bathymetric plots? My email is una146@gmail.com. Thanks in advance!

      Delete
    5. use the command "colorbar" or
      "help colorbar" for more information

      Delete
    6. Hi, would you please send me the script for making these bathymetric plots? My email is kmlim1@sheffield.ac.uk ,Thanks in advance!

      Delete
  2. how can i do this but vertically?

    ReplyDelete
    Replies
    1. I will give you the script and colorbar, please send me your e-mail?

      Delete
  3. Hi..can u send me also.. hafifinazir@gmail.com

    ReplyDelete
  4. may i get your script sir?

    jherjati@s.itb.ac.id

    ReplyDelete
  5. Hi Riza your plots are perfect could you please send me a copy of your matlab script ? I really need it thank you (e-mail: bouradine@ipgp.fr)

    ReplyDelete
  6. Would you share your script with me as well,

    buktenicm@gmail.com

    ReplyDelete
  7. Would you mind sharing your script with me as well

    arjkohli@gmail.com

    Thank you

    ReplyDelete
  8. Would you mind sharing your script with me as well?
    katakhn@gmail.com

    ReplyDelete
  9. Please can you send my your script too?

    max-campbell@hotmail.co.uk

    Thankyou very much

    ReplyDelete
  10. would you mind sharing your sript with me as well ?
    hazimsalma0@gmail.com

    ReplyDelete
  11. Hi riza do you have any code for HF RADAR data?

    ReplyDelete
  12. Hi Riza,
    May I ask you to do me a favor and send me your script.

    Respectfully,
    Ehsan
    sadighehsan@gmail.com

    ReplyDelete
  13. Sir how can we show these bathymetry profile varrying with depth?

    ReplyDelete
  14. Kindly send me a script at davidddumba@gmail.com Thanks in advance

    ReplyDelete
  15. Nice figures! Could you send me the matlab scripts to heychq0926@gmail.com? thanks a lot!

    ReplyDelete
  16. Hi Riza,
    I got a 3D plot instead of a map. Can you please send me the script on vgbest@gmail.com. Thank you in advance.

    ReplyDelete
  17. Great colors for Britain and Indonesia! Can you send me your script too? abochdan@odu.edu. Thank you, Alexander

    ReplyDelete
  18. This comment has been removed by the author.

    ReplyDelete
  19. Would you please send me that script to monocilindro1@gmail.com?
    thanks

    ReplyDelete
  20. This comment has been removed by the author.

    ReplyDelete
  21. Please could you send me your script for the bathymetry map please ?
    Thank You
    (clement.vincentbrest@gmail.com)

    ReplyDelete
  22. Hi Riza,
    could you send me your script aswell?
    Thank you!
    fabian.groscurth@gmail.com

    ReplyDelete
  23. Hi Riza, would really appreciate if u sent me your script for bathymetry. Here my email (wadizukri@gmail.com). thank you!

    ReplyDelete
  24. Hi Riza, I would also like to have your matlab scripts. My email is ronaldsalazar32@gmail.com. Thanks alot!!!!!!!!

    ReplyDelete
  25. Hi Riza, i need your mathlab script for my final task, hope you can send me your script.

    here my email : mr.rikohermansyah@gmail.com

    ReplyDelete
  26. Hi Riza.. would you please send me that script to arifiyana29@gmail.com.. thanks Riza..

    ReplyDelete
  27. Hi,
    I am also very interested in having your script as I'm currently working on a mountain lake.

    hydrogene894@gmail.com

    Thanks a lot

    ReplyDelete
  28. Hi, I need show a graph bathymetry but appears me in the promt this Requested 206414x209349 (322.0GB) array exceeds maximum array size preference. I hope you can help me.
    Thanks in advance

    ReplyDelete
  29. Hello
    I have 3 column in Excel respectly lat, lon, depth. I have a 2d view with depht in color with geoscatter. But yet I would like a bathymetry in 3d with color. Can you help me please or write the code matlab and send me per email:audyb.2@gmail.com thank you

    ReplyDelete
  30. hi riza
    i am raja mohamed and wish if you could share your code to plot the map it would help me in great deal. thank you. rajadelip@gmail.com

    ReplyDelete
  31. Nice Plots and great work.

    Could you please also send me the matlab code to plot the bathymetry data?

    Thanks Lee poteterqing@hotmail.com

    ReplyDelete
  32. please share your matlab batimetric code and color bar and relief
    in order to use and replicate

    ReplyDelete
  33. please share your matlab batrimetric code and color bar and relief
    in order to use and replicate
    sincerely Carlos, e-mail: Ccarmona@ciencias.unam.mx

    ReplyDelete