Random area of no data

1 view (last 30 days)
Sophie
Sophie on 28 Aug 2024
Answered: Star Strider on 28 Aug 2024
Hi,
I am creating a world plot to display data. However, there is a random line appearing in my plot and i dont know why. The figure didn't have this line and then i ran the code again and it randomly appeared and hasnt gone away since.
Is it something with my code?
clear;
clc;
data=load('date.mat', "temp_data_2030_245", "salinity_data_2030_245", "CO3_data_2030_245");
data1=load('245.mat',"co3_lat_245", "co3_lon_245");
Omegalimit = 2.82;
% Import data from files
temp_data = data.temp_data_2030_245;
salinity_data = data.salinity_data_2030_245;
CO3_data = data.CO3_data_2030_245;
lat=data1.co3_lat_245;
lon=data1.co3_lon_245;
CO3_data = CO3_data/1025; %convert to molkg^-1
%Ca
Ca_values = (salinity_data/35)*0.01028;
temp_data1=temp_data;
T = temp_data + 273.15;
S = salinity_data;
Ksp_values = -171.945 - (0.077993 .* T) + (2903.293 ./ T) + (71.595 .* log10(T)) ...
+ ((0.0017276 .* T - 0.068393 + (88.135 ./ T)) .* sqrt(S)) ...
- (0.10018 .* S) + (0.0059415 .* S.^1.5);
%Omega
omega = (CO3_data) .* Ca_values ./ 10.^Ksp_values;
omega = mean(omega, 3);
directory = '/Users/sophie/Documents/Masters/Research Project/01_Data';
fileName = 'WCMC008_CoralReef2021_Py_v4_1.shp';
filePath = fullfile(directory, fileName);
CurrentCoral = shaperead(filePath);
X = [CurrentCoral.X];
Y = [CurrentCoral.Y];
figure(3);
sgtitle('Aragonite Saturation State under SSP 245 in Summer');
subplot(3,1,1);
worldmap('World');
set(gcf, 'Color', 'w');
land = shaperead('landareas', 'UseGeoCoords', true);
geoshow(lat, lon, omega, 'DisplayType', 'texturemap');
mlabel off; plabel off; gridm off
hold on;
geoshow(land, 'DisplayType', 'polygon', 'FaceColor', 'k');
title('2030');
xlabel('Longitude');
ylabel('Latitude');
colormap('turbo');
set(gcf, 'Position', [100, 100, 800, 600]);
hold on;
plotm(Y, X, 'ro', 'MarkerSize', 1, 'MarkerFaceColor', 'r');

Answers (1)

Star Strider
Star Strider on 28 Aug 2024
I do not have your data, and I am not certain what ‘randomly’ implies.. Consider usinig the fillmissing function if the data creating the meridian line at about 50°E are actually missing data.
You did not list your MATLAB version/release. Be sure that you have downloaded and installed all the updates for your particluar version. This could be a bug that has been fixed.

Categories

Find more on Data Preprocessing in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!