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

3 vues (au cours des 30 derniers jours)
Sara Hesse
Sara Hesse le 10 Déc 2022
Commenté : Voss le 10 Déc 2022
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!

Réponse acceptée

Voss
Voss le 10 Déc 2022
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 commentaires
Sara Hesse
Sara Hesse le 10 Déc 2022
Awesome! That works! Thank you so much!
Voss
Voss le 10 Déc 2022
You're welcome!

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by