[ncl-talk] Discussion

Beáta Szabó-Takács szabo.b at czechglobe.cz
Thu Jul 19 07:02:04 MDT 2018


Dear Soma,
I have ever calculated the wet-dry seasons but in Matlab. I do not know if you need a help how you can find the time in the dry and in the wet seasons or you need an ncl script to do it? Firstly, you should calculate the yearly precipitation sum from daily data. I did it with CDO (cdo yearsum input.nc output.nc). After it, you have to average the yearly sum of precipitation over the field and have to sort the precipitation values in the time dimension. The first half of the sorted time will be the dry period if you sort the precipitation by ascending.
I created a brief ncl script to find the years in dry and in wet seasons. I used E-OBS data in 1961-1990.

begin

f = addfile("E-OBS_1961-1990_pr.nc", "r")
time = f->time                                  ; daily time values
pr  = f->pr(:,:,:)                                 ; daily precipitation values
time_size=dimsizes(time)               ; get the daily data time length

f2 = addfile("E-OBS_1961-1990_pr_ys.nc", "r")     ; yearly_sum precipitation: cdo yearsum E-OBS_1961-1990_pr.nc E-OBS_1961-1990_pr_ys.nc
pr_year_sum = f2->pr(:,:,:)
time2 = f2->time
dsizes_pr = dimsizes(pr_year_sum)
tim_dims = dsizes_pr(0)             ; get the time length
lon_dims = dsizes_pr(1)             ; get the longitude dimension length
lat_dims = dsizes_pr(2)              ; get the latitude dimension length

pr_reshape = reshape(pr_year_sum,(/tim_dims,(lon_dims*lat_dims)/))                   ; reshape 3D array to 2D one (time,gridpoints)

  pr_aver = dim_avg(pr_reshape)                                                                                        ; average the yearly sum precipitation over the field

pr_sort = dim_pqsort_n(pr_aver,1,0)                                                                            ;sort the averaged precipitation and its time dimension to find the dry and wet season
; print(pr_sort)

time_sort = new((/tim_dims/),"double")                                                            ; create an array for sorted time
pr1 = new((/tim_dims/),"float")                                                                            ; create an array for sorted precipitation values

do n=0,tim_dims-1
time_sort(n) = time2(pr_sort(n))                                                                           ; gives the sorted time
pr1(n) = pr_aver(pr_sort(n))                                                                                   ; gives the sorted precipitation yearly sum values
end do
;print(time_sort)
; print(pr1)


utc_date = cd_calendar(time_sort,0)                                                                    ; convert the serial date to calendar date
year= tointeger(utc_date(:,0))                                                                                 ; gives the year values
year_dry = tointeger(utc_date(0:((tim_dims/2)-1),0))                                        ; years in dry period
year_wet = tointeger(utc_date((tim_dims/2):tim_dims-1,0))                             ; years in wet_period

print(year_dry)
print(year_wet)

end

I tried to find the daily precipitation values with the following way but I am afraid of that it is not a correct way:

utc_date2 = cd_calendar(time,0)                                           ; time is daily time data
year2 = tointeger(utc_date2(:,0))                                          ; get the years from serial date data

do j=0,(tim_dims/2)-1
  do n=0,time_size-1
    if(year2(n).eq.year_dry(j)) then
     pr_dry=pr(n,:,:)
    else
     pr_wet=pr(n,:,:)
    end if
   end do
  end do

  printVarSummary(pr_dry)

Maybe someone else can help you extract the daily data in ncl.

I hope I could help you!
Have a nice day,
Beata

From: Soma Roy [mailto:somaroy892 at gmail.com]
Sent: Wednesday, July 18, 2018 12:01 PM
To: Beáta Szabó-Takács <szabo.b at czechglobe.cz>
Subject: Discussion

Sir,

Thanks for your help in ncl script.
May I get a help from your side. This is not ncl related matter.

I am trying to calculate wet and dry season over India using Indian Meteorological Depeartment (IMD) data for 1970-2013. Data is available at daily basis.

I prepared the database for the estimation of wet and dry season. But not yet understand how to extract those season.

Can you please help me in this matter?

Thanking you,
Soma


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180719/437b74f8/attachment.html>


More information about the ncl-talk mailing list