Extracting coordinate values from a 3-D matrix from within the data iteself and ploting a 3D map

3 views (last 30 days)
Hi,
I have a set of ocean data that is shown in the attachment. The latitude and longitude coordinates are given in two separate arrays of different sizes, latitude being a 1x720 array and longitude being a 1x1440 array. They are attached to monthly mean sea level measurements in the variable sla, which is a 1440x720x276 matrix. The format of sla is lon x lati x month of the year i.e. time. The values given in sla, however, are the values of sea level, and the latitude and longitude data that those points are connected to are not present in that matrix.
I subset the data spatially into 60 by 60 by 276 grid and tried to convert the sla into 2D matrix by repmat which resulted in 3600 by 276 matrix. Then using the longitude and latitude variable that comes separately with data as lon and lat var, I generated two matrix by repeating the lat and lon values for a grid and generated lat lon matrices corresponding to eahc index (all 3600) in sla files. I concatenated the data sla for a given month based on their index values and the lat and lon matrices and plotted them using fastscatter funsction. Output of plot is given in grid cells where I have the lat-lon coordinates of each cell and the sla for a given month. The problem I need help with is that X-axis is lat and Y is lon whereas this should be opposite. I think this problem is because I am accessing the data using indexes not coordinates.
I want to plot sla spatially for each grid point, on a map of the area, based on their associated coordinate location in latitude and longitude. My goal is to generate a matrix with three columns, where the first row is lon, the second is lst , and the third is the sla derived from 'sla' matrix for a particular month of the year. Any help is greatly appreciated. Please let me know if you need
  3 Comments
skanwal
skanwal on 14 Nov 2018
I useded indexing method because I don't know how to access the cooridantes values stores wthin sla. data set. Indexing method finally give me the correct plot but the problem is that the lon and lat are interchanged on the axis only while the plot is correct. Plz see the attached figure. This way I cannot plot the coastline.
skanwal
skanwal on 14 Nov 2018
Plot is correct as the features are located on the right place but the axis is not positioned correct. Lat should go on the Y an dlon on h eX while keeping the plot shape same.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!