[ncl-talk] stat_desp code

ali mughal mughalali655 at gmail.com
Mon Apr 29 00:49:36 MDT 2024


Hi
My following little code is not providing value of the percentiles probably
because of missing values

dir_agcd = "/data2/WRF_ERA5_out/SWWA/AGCD_regrid_mon/means/"
dir_wrf = "/data2/WRF_ERA5_out/SWWA/wrf_seasmean/"
ens = "R3"
yr_start = "1980"
yr_end = "2019"
nlon = 523
nlat = 346
opt = True
system("mkdir -p " + diro)
f_agcd_tmax = addfile(dir_agcd + "agcd_v1-0-1_" + "tmax_" + yr_start + "_"
+ yr_end + "_seasmean.nc", "r")
agcd_tmax = f_agcd_tmax->tmax
delete(f_agcd_tmax)
f_wrf_tasmax = addfile(dir_wrf + "tasmax_" + ens + "_" + yr_start + "_" +
yr_end + "_seasmean.nc", "r")
wrf_tasmax = (f_wrf_tasmax->tasmax)
wrf_tasmax = wrf_tasmax-273
delete(f_wrf_tasmax)

do i = 0, nlat - 1, 1
    do j = 0, nlon - 1, 1
        agcd_tmax_out = agcd_tmax(:, i, j)
        if all(ismissing(agcd_tmax_out)) .eq. False then
            wrf_tasmax_out = wrf_tasmax(:, i, j)
            stat_agcd_tmax = stat_dispersion(agcd_tmax_out, opt)
            stat_wrf_tasmax = stat_dispersion(wrf_tasmax_out, opt)
        else
            delete(agcd_tmax_out)
        end if
    end do
end do
print(stat_agcd_tmax)
print(stat_wrf_tasmax)

Output
Variable: stat_agcd_tmax
Type: float
Total Size: 120 bytes
            30 values
Number of Dimensions: 1
Dimensions and sizes:   [30]
Coordinates:
Number Of Attributes: 2
  long_name :   Robust Dispersion Statistics
  _FillValue :  1e+20
(0)     31.07983
(1)     0.768555
(2)     29.00586
(3)     29.96567
(4)     30.07379
(5)     30.28866
(6)     30.6044
(7)     30.78744
(8)     31.18414
(9)     31.38833
(10)    31.58258
(11)    31.85179
(12)    31.96011
(13)    32.05429
(14)    32.88403
(15)    3.878166
(16)    5.046049
(17)    0.7660876
(18)    156
(19)    156
(20)     0
(21)     0
(22)    1e+20
(23)    1e+20
(24)    1e+20
(25)    1e+20
(26)    1e+20
(27)    1e+20
(28)    -0.2533386
(29)    -0.2925659


Variable: stat_wrf_tasmax
Type: float
Total Size: 120 bytes
            30 values
Number of Dimensions: 1
Dimensions and sizes:   [30]
Coordinates:
Number Of Attributes: 3
  units :       K
  long_name :   Robust Dispersion Statistics: Daily Maximum Near-Surface
Air Temperature
  _FillValue :  1e+20
(0)     25.65089
(1)     0.8997155
(2)     23.26544
(3)     24.28622
(4)     24.36398
(5)     24.49762
(6)     25.16293
(7)     25.38058
(8)     25.80746
(9)     26.04553
(10)    26.27335
(11)    26.43805
(12)    26.66354
(13)    26.73364
(14)    28.01169
(15)    4.746246
(16)    5.275275
(17)    0.8968271
(18)    156
(19)    156
(20)     0
(21)     0
(22)    1e+20
(23)    1e+20
(24)    1e+20
(25)    1e+20
(26)    1e+20
(27)    1e+20
(28)    -0.4017957
(29)    -0.3656675
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20240429/22266842/attachment-0001.htm>


More information about the ncl-talk mailing list