フィルターのクリア

Patch not working properly with 2d latitude and longitude

2 ビュー (過去 30 日間)
MICHELE GNESOTTO
MICHELE GNESOTTO 2022 年 5 月 16 日
編集済み: Voss 2022 年 5 月 17 日
Hi all,
i am trying to plot the sea surface temperature from a netcdf file. when i upload it , i have this
i tried to use patch in this way
patch(longitude ,latitude , mean(tos,3,'omitnan') , 'FaceColor','interp', 'EdgeColor' , 'interp' )
but the results is not good , i have temperature over the land , so i think something is wrong with my grid, but
I can't understand why. If you have any suggestion to help I would very appreciate it.
Thanks
Michele

採用された回答

Voss
Voss 2022 年 5 月 17 日
Try using surface instead of patch.
  6 件のコメント
MICHELE GNESOTTO
MICHELE GNESOTTO 2022 年 5 月 17 日
yea thanks looks good , do you think is possible to plot coastlines in these case?
Voss
Voss 2022 年 5 月 17 日
編集済み: Voss 2022 年 5 月 17 日
Here it is using latitude and longitude. It appears to have better proportions now.
[The longitude goes from 72.5 up to 360 then wraps around back to 0 and up to 73.5, but there is a little dip around 271 where it decreases for one sample, so to try to get it right, I find where there is the big decrease from 360 to 0 and add 360 to samples after that, so that from beginning to end it's ~72.5 to ~433.5. Then I label the xticks with mod(longitude,360). I'm sure you can get something better with stuff from the mapping toolbox, if you have it.]
unzip('adaptor.esgf_wps.retrieve-1652740104.757926-1767-15-d7ea9cac-5f2f-4b52-9b1f-0ba84ab0122b.zip')
longitude = ncread('tos_Omon_CMCC-ESM2_ssp585_r1i1p1f1_gn_21000116-21000116_v20210126.nc','longitude');
latitude = ncread('tos_Omon_CMCC-ESM2_ssp585_r1i1p1f1_gn_21000116-21000116_v20210126.nc','latitude');
tos = ncread('tos_Omon_CMCC-ESM2_ssp585_r1i1p1f1_gn_21000116-21000116_v20210126.nc','tos');
longitude = longitude(:,1);
disp([longitude(195:205) [NaN; diff(longitude(195:205))]]);
267.1299 NaN 268.0960 0.9661 269.0615 0.9655 270.0265 0.9650 270.9909 0.9644 271.9549 0.9640 270.7897 -1.1652 271.7916 1.0019 272.7956 1.0040 273.8017 1.0061 274.8098 1.0081
idx = find(diff(longitude) < -350,1);
longitude(idx+1:end) = 360+longitude(idx+1:end);
figure();
surface(longitude(:,1),latitude(1,:),tos.', ...
'FaceColor','interp', ...
'EdgeColor','interp');
axis equal
xticklabels(sprintfc('%d',mod(xticks(),360)))
Regarding plotting coastlines, I'm not sure.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGeographic Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by