[ncl-talk] Dust concentration from 5 dust bin sizes
Setareh Rahimi
setareh.rahimi at gmail.com
Tue Nov 8 03:56:40 MST 2022
Dear NCL users,
I am trying to plot the total dust concentration from the WRF-Chem output.
To achieve this end, I sum over 5 dust bin sizes (check the attached
script) this way:
"at= a1+a2+a3+a4+a5".
I am not sure if this way of summation over 5 variables work correctly!
However, as you can see from the attached screenshot, I received some
errors. The first error is weird to me cause I did not define the variable
"x" in my script.
"fatal:(missing) is not a named dimension in variable (x)".
What is wrong with my script that NCL cannot recognize the "(Day)" variable?
Please kindly advise me in terms of these issues.
Best wishes,
DUST_chem.nc.gz
<https://drive.google.com/file/d/1_YBJguj3TFdH8ih6rIxE7pz8HeFlqmgE/view?usp=drive_web>
--
S.Rahimi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20221108/9a573f60/attachment.htm>
-------------- next part --------------
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl"
;***************************************************************************************************************************
f = addfile ("wrfout_d01_2011-06-22_00:00:00", "r")
;print(f) ; same as "nmcdump -h"
Times = f->Times ; [Time | 41] x [DateStrLen | 19] (character)
Time_0 = wrf_times_c( Times, 0 ) ; "hours since" initial time on file (double)
; Time_0 is recognized by cd_calendar
Time_3 = wrf_times_c( Times, 3 ) ; yyyymmddhh (type "integer")
Time_3 = Time_3/100 ; remove 'ss' part of Time_3
Time_3 at units = "yyyymmdd"
ymd = cd_calendar(Time_0, -2)
print(ymd)
YMD = 20110630
print("********************************************************************************************************************")
wks = gsn_open_wks("png" ,"WRF_dust_wind_Daily-Average"+YMD) ; ps,pdf,x11,ncgm,eps
;gsn_define_colormap(wks,"GMT_no_green") ; select color map
res = True ; plot mods desired
res at cnConstFEnableFill = True
res at gsnMaximize = True
res at gsnSpreadColors = True
res at cnFillOn = True
res at cnLinesOn = False
res at cnLineLabelsOn = Fals
WRF_map_c(f, res, 0)
res at tfDoNDCOverlay = True
;*********************************************************************************************************************
;*********************************************************************************************************************
;res at cnLevelSelectionMode = "ExplicitLevels"
;res at cnLevels = (/0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2,2.1,2.2,2.3,2.4,2.5/)
res at mpFillOn = False
res at mpLimitMode = "LatLon" ; choose region of map
res at mpDataBaseVersion = "MediumRes" ; better map outlines
res at pmTickMarkDisplayMode= "Always" ; turn on tickmarks
res at pmTickMarkDisplayMode = "Always"
res at mpMaxLatF = 40 ; choose subregion
res at mpMinLatF = 24
res at mpMaxLonF = 63
res at mpMinLonF = 44
;***************************************************************************************************************************
;ymd = cd_calendar(Time_0, -2)
;print(ymd)
;YMD = 20110705
mt = ind(YMD.eq.ymd)
A1 = f->DUST_1 ; (Time, south_north, west_east)
A1&Time = Time_0 ; associate the 'Time' coordinate with the variable using standard NCL & syntax
a1 = A1(mt,:,:,:) ; (Time, south_north, west_east)
printVarSummary(a1) ; [Time | 8] x [bottom_top | 35] x [south_north | 199] x [west_east | 199]
;***************************************************************************************************************************
A2 =f->DUST_2
A2&Time = Time_0
a2 = A2(mt,:,:,:)
A3 =f->DUST_3
A3&Time = Time_0
a3 = A3(mt,:,:,:)
A4 =f->DUST_4
A4&Time = Time_0
a4 = A4(mt,:,:,:)
A5 =f->DUST_5
A5&Time = Time_0
a5 = A5(mt,:,:,:)
;***************************************************************************************************************************
at= a1+a2+a3+a4+a5 ;sum over all 5 dust bin sizes to get total dust concentration
at at time = "Time"
at at long_name = "Total dust"
at at description = "Total dust from 5 bin dust sizes"
if (any(isnan_ieee(at))) then
value = 9.96921e+36
replace_ieeenan (at,0)
at at _FillValue = value
end if
printVarSummary(at)
;print(at)
;***************************************************************************************************************************
time_3 = Time_3(mt) ; (Time | 8)
print(time_3)
print("********************************************************************************************************************")
opt_cdv = True ; option for calculate_daily_values (cdv)
opt_cdv at nval_crit = 4 ; default is 1
Day = calculate_daily_values (at, "avg", 0, opt_cdv)
printVarSummary(Day) ; [Time | 1] x [bottom_top | 35] x [south_north | 199] x [west_east | 199]
printMinMax (Day,1)
print(Day)
dd = dim_sum_n_Wrap( Day(:,0:34,:,:), 1)
printVarSummary(dd)
;print(dd)
print("")
print("***********************************************************************************************************")
print("***********************************************************************************************************")
print("")
res at tiMainString = "DUST- " + time_3(0)
plot = gsn_csm_contour_map(wks,dd(0,:,:),res)
shapefile_name1 = "world-administrative-boundaries.shp"
shapefile_name2 = "gadm36_IRN_0.shp"
lnres = True
lnres at gsLineThicknessF = 3.0
lnres at gsLineColor = "Black"
shape1 = gsn_add_shapefile_polylines(wks,plot,shapefile_name1,lnres)
shape2 = gsn_add_shapefile_polylines(wks,plot,shapefile_name2,lnres)
res at gsnDraw = False
res at gsnFrame= False
draw(plot)
frame(wks)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dust.png
Type: image/png
Size: 151996 bytes
Desc: not available
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20221108/9a573f60/attachment.png>
More information about the ncl-talk
mailing list