How to plot a spatial Map of Rainfall for specific latitude and longitude geographic coordinate grid?

2 views (last 30 days)
Hello Everyone, I have problem with dataset to Reshape an array for spatially explicit data: What I have done, I am describing step by step and I am looking for code to plot the data spatially.
Step 1: I extracted a 3-dimensional data for a specific time period.
Step 2: I applied masking on 3-D data to get the values for a specific region (longitude and latitude) which resulted in a 2-D matrix containing values spatially distributed over grid cells for specific time period.
Step 3: After applying masking function, I interpolated the resultant dataset (2-D)to fill the gaps existing the dataset.
Step 4: Now, I have data values for specific time period spatially distributed across grid cells of the region.
Now I want to convert this 2-D dataset into 3-D with values for specific latitude and longitude. How could I plot this interpolated data, so that data points remain same as with the original coordinates?

Answers (1)

Abhinaya Kennedy
Abhinaya Kennedy on 7 May 2024
Hi Pankaj,
To plot your 2-D spatially interpolated dataset with original latitude and longitude coordinates in 3-D using MATLAB,
Step 1: Prepare your data by ensuring you have your latitude, longitude, and 2-D interpolated data ready. Here's an example:
% Example latitude and longitude vectors
latitudes = linspace(-90, 90, your_lat_size); % Replace your_lat_size with the size of your latitude data
longitudes = linspace(-180, 180, your_lon_size); % Replace your_lon_size with the size of your longitude data
% Your 2-D interpolated data matrix
data = rand(your_lat_size, your_lon_size); % Replace this with your actual 2-D data
Step 2: Create a "meshgrid"
Step 3: Use the "surf" function for 3-D surface plotting.
You can find additional information here: https://www.mathworks.com/help/matlab/ref/meshgrid.html

Community Treasure Hunt

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

Start Hunting!