how to turn netcdf into contour map

8 ビュー (過去 30 日間)
Abigail Waring
Abigail Waring 2021 年 4 月 28 日
コメント済み: Abigail Waring 2021 年 5 月 12 日
I have T2M data plot and want to put it into a contour plot at lat and lon 80.5N and -58W showing T2M over time how do I do this?
I've never used this before
Thanks

採用された回答

Chad Greene
Chad Greene 2021 年 5 月 2 日
Hi Abigail,
The first thing I do with a netcdf file is type
ncdisp('myfile.nc')
to see what's inside it. If you have some variables named latitude, longitude, and T2M, read them in like this:
lon = ncread('myfile.nc','longitude');
lat = ncread('myfile.nc','latitude');
T = ncread('myfile.nc','T2M');
Most of the time with NetCDF's of climate data, you'll have to swap the first two dimensions of any gridded data. That probably looks like this:
T = permute(T,[2 1]);
for 2D data or
T = permute(T,[2 1 3]);
if T is a 3D data cube.
Assuming T is 3D where the third dimension corresponds to time, you could contour the first time slice like this:
contour(lon,lat,T)
But you say you want to show T over time. What exactly do you mean by that?
  1 件のコメント
Abigail Waring
Abigail Waring 2021 年 5 月 12 日
Thank you
I managed to get it working but had to rewrite the code

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by