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

조회 수: 3 (최근 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 CenterFile Exchange에서 Surface 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