Problem with z value output when computing elevation along a straight line transect
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I'm trying to use the compute elevation profile along a straight line code available at: https://uk.mathworks.com/help/map/data-grid-values-along-a-path.html, to determine the elevation (z) along a straight line transect in a fake domain with elevation which goes from -30m to -60m.
However, when I checked the z value I found it is not calculated for the entire straight line transect (it stops at 42.1 degrees but should end at 42.6 degrees).
Does anyone know how to calculate z for the entire straight line?
I have included the code below:
if true
% code
% Fake domain
DDX = 1000; % Varation in the domain size for X
DDY = 2000; % Variation in the domain size for Y
% Elevation -30 to -60 m
Zx = linspace(-30,-60,DDY); % (X) longitudinal bathymetry values
Zy = linspace(-30,-60,DDX); % (Y) latitudinal bathymetry values
Z = meshgrid(Zx,Zy); % Vector Z containing bathymetry values
% Define latitude and longitude of map area
latlim = [41.6, 42.6];
lonlim = [-70.9, -69.9];
% Vectors of latitude and longitude with same interval size as bathymetry
latvec = linspace(latlim(1),latlim(2),DDY);
lonvec = linspace(lonlim(1),lonlim(2),DDX);
% Convert domain to referenced grid using makerefmat function: https://uk.mathworks.com/help/map/ref/makerefmat.html
dy = abs(latlim(1)-latlim(2))/DDY;
% initial latitude 41.6 minus end latitude 42.6 divided by the number of elements in array DDY
dx = abs(lonlim(1)-lonlim(2))/DDX;
% Specify the coordinates for the left hand corner of the map domain
x11 = lonlim(1);
y11 = latlim(1);
% Create the referenced bathymetry grid needed by mapprofile function
R = makerefmat(x11, y11, dx, dy);
% Input source and end lat/long for straight line transect
sourcelat = 42.0;
sourcelon = -70.8;
endlat = 42.6;
endlon = -70.7;
% Define the endpoints for a straight-line transect through the domain
plat = [sourcelat endlat];
plon = [sourcelon endlon];
% Calculate the change in elevation along the straight line transect
[z,rng,lat,lon] = mapprofile(Z,R,plat,plon);
end
0 comentarios
Respuestas (1)
Amy Haskins
el 18 de Abr. de 2018
I think the problem is that the referencing matrix isn't quite right. Assuming your grid is regularly spaced in lat/lon, try using georefcells instead to create a referencing object.
R = georefcells(latlim,lonlim,dx,dy);
1 comentario
Ver también
Categorías
Más información sobre Geology en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!