Azzera filtri
Azzera filtri

How can I remove shading from regions outside my domain?

2 visualizzazioni (ultimi 30 giorni)
I am doing some correlation analyses inside my domain (Missouri River Basin). The correlation analyses are being performed on a set of text files that I originally produced in ArcMap.
When I detrend the data, I notice that I have shading in areas where I don't have values (areas outside of the text file).
I'm not receiving an error when I run the following script...
%information used to define the domain for each text file
xllcorner=-113.93814129921;
yllcorner=37.024602300864;
cellsize=0.041666666667;
XLONG=xllcorner:cellsize:(xllcorner+(572-1)*cellsize);
XLAT=(yllcorner+(287-1)*cellsize):(-1)*cellsize:yllcorner;
[ConXLONG,ConXLAT]=meshgrid(XLONG,XLAT);
%%Load Ascii Text Files
load 1985mrbavgdailymeantascii.txt
X1985mrbavgdailymeantascii(find(X1985mrbavgdailymeantascii==-9999))=NaN;
X1985mrbavgdailymeantascii(isnan(X1985mrbavgdailymeantascii))=0;
load 1986mrbavgdailymeant.txt
X1986mrbavgdailymeant(find(X1986mrbavgdailymeant==-9999))=NaN;
X1986mrbavgdailymeant(isnan(X1986mrbavgdailymeant))=0;
%detrend the time-series of the concatenated text files, and perform and plot correlation analysis
detrendll3test1=detrend(ll3test1,'constant');
for i=1:572
for j=1:287
R=corrcoef(cornMRBdetrend',detrendll3test1(j,i,:));
ccCORNdetrend(j,i)=R(1,2);
end
end
%
figure
pcolor(ConXLONG,ConXLAT,ccCORNdetrend)
shading flat
caxis([-1 1])
colorbar
hold on
colormap bluewhitered(20)
axis equal
xlabel('Longitude')
ylabel('Latitude')
title('Correlation Coefficent Between Annual Corn Yields (Detrended) and Annual Daily Mean Temperatures Across the MRB')
Can someone help me figure out why the regions that exist outside of my domain are shaded and have color? I thought this area outside the domain would be left as white or neutral. Thanks!

Risposte (1)

Chad Greene
Chad Greene il 6 Ago 2018
Modificato: Chad Greene il 6 Ago 2018
It looks like the detrend call should be inside the loop, because currently it's operating down dimension 1 of the data rather than down dimension 3. That's why you get vertical stripes. Try this instead:
for i=1:572
for j=1:287
detrendll3test1=detrend(squeeze(ll3test1(j,i,:)),'constant');
R=corrcoef(cornMRBdetrend',detrendll3test1);
ccCORNdetrend(j,i)=R(1,2);
end
end

Categorie

Scopri di più su Climate Science and Analysis 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