Issue with map orientation
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I'm trying to visualise a map output in MatLAB downloaded from ETOPO.01-NASA bathymetry database, but I can't obtain the right orientation of the map. I know it's wrong from the fact that the map is oriented differently in the website, so there must be an error with the coordinates input.
I used the following code and also provided an example of the figure obtained:
cd(datadir)
filename = 'ningaloo_etopo.tiff'
%load data
etopo = imread(filename);
%convert to floating point data:
etopo = double(etopo);
%Create lon and lat arrays
laS = -23.00
laN = -20.00
loW = 110.00
loE = 115
dlat = (laN - laS) / (size(etopo, 2) -1);
dlon = (loE - loW) / (size(etopo,1) -1);
lat = [laN : -dlat : laS];
lon = [loW : dlon : loE];
%Visualise using pcolor
figure(1)
clf
pcolor(lon,lat,etopo')
hold on
contour(lon,lat,etopo', [0, 0], 'k')
COORDINATES ARE: 110°W,-23°S,115°E,-20°N
If you quickly insert the coordinates here (https://maps.ngdc.noaa.gov/viewers/grid-extract/index.html) there's a grid-extractor from which you can select 'etopo01(bedrock)' as option and obtain the image of how the area should be like. This will help to figure out the map output I need to obtain.
0 Kommentare
Antworten (1)
Milan Bansal
am 3 Mai 2024
Hi Filippo Bocchi,
The orientation issue with your map is likely due to the way you are creating the arrays for latitude (lat) and longitude (lon), particularly in terms of the sequence and direction you have chosen for them. It appears there is a mix-up in calculating "dlat" and "dlon"; the correct approach would be to calculate "dlat" based on the image's height (number of rows) and "dlon" according to its width (number of columns).
Considering the coordinates you have mentioned (110°E to 115°E and -23°S to -20°N), your map is expected to stretch from the west to the east along the x-axis and from the north to the south along the y-axis.
Please modify your code as shown in the following code snippet:
filename = 'ningaloo_etopo.tiff';
% Load data
etopo = imread(filename);
% Convert to floating point data
etopo = double(etopo);
% Create lon and lat arrays
laS = -23.00;
laN = -20.00;
loW = 110.00;
loE = 115.00;
% Correcting dlat and dlon calculation
dlat = (laN - laS) / (size(etopo, 1) - 1); % Latitude difference divided by the number of rows
dlon = (loE - loW) / (size(etopo, 2) - 1); % Longitude difference divided by the number of columns
lat = laN:-dlat:laS; % Corrected to increase from South to North
lon = loW:dlon:loE; % Corrected to increase from West to East
% Visualise using pcolor
figure(1)
clf
pcolor(lon,lat,etopo)
hold on
contour(lon,lat,etopo, [0, 0], 'k')
Here is the output obtained from the above code.
Hope this helps!
0 Kommentare
Siehe auch
Kategorien
Mehr zu Oceanography and Hydrology finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!