Azzera filtri
Azzera filtri

Plot a precipitation grid, Matlab

1 visualizzazione (ultimi 30 giorni)
SuzieChan
SuzieChan il 22 Apr 2020
Commentato: Star Strider il 22 Apr 2020
Hi, I want to plot a precipitation grid across the extent of my DEM.
The data I have are for 8 locations and show 2 things: (i) lat/long; (ii) total precip for each location.
Can you help me use the meshgrid and scatteredinterpolant functions to do this?
Here are the data:
%Lat Long Total Precip (mm)
53.2879 -1.57772 1020
53.406 -1.73752 981
53.3642 -1.70167 1002
53.3362 -1.74618 1500
53.3147 -1.7017 1807
53.274 -1.69155 1492
53.2494 -1.61264 1325
53.227 -1.609 997
% Define the data
lat=precip_data(:,1);
lon=precip_data(:,2);
total_precip=precip_data(:,3);
% Do I need to change the lat/long corrdinates to projected UTM?
% DEM coordinate system is CT_TransverseMercator / OSGB1936 datum.
% How do I create the meshgrid and scatteredInterpolant for each of the 8 data?

Risposta accettata

Star Strider
Star Strider il 22 Apr 2020
Try this:
D = [53.2879 -1.57772 1020
53.406 -1.73752 981
53.3642 -1.70167 1002
53.3362 -1.74618 1500
53.3147 -1.7017 1807
53.274 -1.69155 1492
53.2494 -1.61264 1325
53.227 -1.609 997];
N = 20; % Size Of Interpolation Vectors/Matrices
Ltv = linspace(min(D(:,1)), max(D(:,1)), N); % Latitude Vector For Interpolation
Lnv = linspace(min(D(:,2)), max(D(:,2)), N); % Longitude Vector For Interpolation
[Ltm,Lnm] = ndgrid(Ltv, Lnv); % Matrices For Interpolation
Pm = griddata(D(:,1), D(:,2), D(:,3), Ltm, Lnm); % Interpolate
figure
surf(Ltm, Lnm, Pm)
grid on
view(40,40)
xlabel('Latitude')
ylabel('Longitude')
zlabel('Precipitation (Interpolated)')
Change 'N’ to get different results.
.
  2 Commenti
SuzieChan
SuzieChan il 22 Apr 2020
Modificato: SuzieChan il 22 Apr 2020
Hi Star.
  • How can I plot this surface across the extent of my DEM? Do I need to change the surface coordinate system to UTM first? I want it to look like a 2D precip gradient across the DEM surface.
Star Strider
Star Strider il 22 Apr 2020
I have no idea what you are talking about.
You simply asked for an interpolation approach using the data you posted, and I provided it. If you are using Mapping Toolbox functions (that I do not have access to because I do not have the Mapping Toolbox), then perhaps a similar approach exists in its functions.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Interpolation in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by