continuous contours in sphere map

2 views (last 30 days)
Diana  Saturnino
Diana Saturnino on 27 Mar 2012
Hello,
I'm using the mapping toolbox to make contours of measures of magnetic field component and plotting them in a Hammer projection. My original data was in 3 vectors: latitude, longitude and variable values. I used meshgrid to obtain a grid for the latitude and longitude values and griddata to obtain the matrix to pass to contourm.
My problem is: In the projection I should have the same values of the variable in the longitude limits (0º and 360º of longitude), because I'm plotting the whole globe. But griddata doesn't interpolate the variable in the these limits. So I end up with a discontinuity in the variable in one meridian. You can see the problem in this image:
Any idea on how to solve this?
Thank you very much!

Answers (1)

Rob Comer
Rob Comer on 29 Mar 2012
I think you can get griddata to approximate the spherical topology by replicating some of your scattered input points before calling it. Try duplicating all the points in the longitude interval [0 30], for example, and add 360 to the longitudes of the duplicates. Then duplicate the points in [330 360] and subtract 360 from the longitudes of the duplicates. Now your data set will span, roughly, [-30 390]. Grid it this way, then truncate both east and west to bring the grid back to [0 360].
Then, before calling contourm, use georasterref to set up a geographic raster reference object, R, and use the contourm(Z,R,...) syntax. As long as R.Lonlim spans 360 degrees, contourm will handle the longitude wrapping from here. (Don't try to use the contourm(lat, lon, Z, ...) syntax.)
  1 Comment
Diana  Saturnino
Diana Saturnino on 30 Mar 2012
Thank you for your answer.
I tried your idea but unfortunately I end up getting the same problem again....
It didn't work.

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!