Can I set variable TSK to NaN in WRF output file?

1 回表示 (過去 30 日間)
Sara Hesse
Sara Hesse 2022 年 12 月 10 日
コメント済み: Voss 2022 年 12 月 10 日
Hi there,
Basically, I need to produce a surface temperature plot with a certain colour scheme, but as you can see below, I have a few points which are way hotter than expected and are throwing off the rest of the map;
I'm using the TSK variable from WRF to make this plot. I was wondering if there might be anyway to set TSK values in the WRF output file to NaN when TSK exceeds 328 K?
Thank you!

採用された回答

Voss
Voss 2022 年 12 月 10 日
Code adapted from your other question.
filename=('wrfout_d03_2018-07-03_12:00:00');
temp=ncread(filename, 'TSK');
temp(temp > 328) = NaN; % set any temp > 328 to NaN
% temp(temp > 328 | temp < 283) = NaN; % or if you wanted to set any temp
% outside the range 283->328 to NaN
longitude=ncread(filename, 'XLONG');
latitude=ncread(filename, 'XLAT');
mycolours = [0 0 168/255; 0 0 250/255; 0 52/255 1; 0 129/255 1; 0 200/255 1; 35/255 1 212/255; 93/255 1 154/255; 154/255 1 93/255; 212/255 1 35/255; 1 219/255 0; 1 148/255 0; 1 82/255 0; 250/255 15/255 0; 168/255 0 0]
colormap(mycolours);
contourf(longitude, latitude, temp, 283:328);
  2 件のコメント
Sara Hesse
Sara Hesse 2022 年 12 月 10 日
Awesome! That works! Thank you so much!
Voss
Voss 2022 年 12 月 10 日
You're welcome!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by