[ncl-talk] detrend not working right and calculate_monthly_values
Ipshita Majhi
ipmajhi at alaska.edu
Tue Feb 16 13:14:20 MST 2016
Dear NCL,
I have been working on making a plot with correlation between detrended
data (snow cover extent) and I had first
used CDO to convert weekly data to monthly data. In the process the lat and
lon cordinates became y and x.
It works fine if till I reorder it. But it is not calculating dtrend
correctly, all the values are fill values.
I worked on using calculate_monthly_values to see if I could use it convert
weekly to monthly in NCL and I could not use it. I would be grateful for
any input
Here is the code I am using
;============================================
; set up parameters
;============================================
;This is extracting latitude of Western Europe
;Reading in the data
a=addfile("~/Documents/NCL_files/Snow_cover_IMS/NCL_codes/sce_mon_mean.nc","r")
; open output netCDF file
b=addfile("~/Documents/NCL_files/Snow_cover_IMS/
nhsce_v01r01_19661004_20140602.nc","r")
;Extracting snow cover extent (sce) from respective data files
sce=byte2flt(a->sce)
sce at _FillValue = 9.9621e+36
lat=b->latitude
lon=b->longitude
sce at lat2d=lat
sce at lon2d=lon
;==============================================
;Reading in JJAS rainfall
JJAS_1871_2012
=asciiread("~/Documents/NCL_files/SST/Monthly/jjas_1871_2012.txt",(/142,1/),"float")
;Extracting JJAS for 1967 to 2012
JJAS_1967_2012=JJAS_1871_2012(96:141,0)
;============================================
;Extracting monthly data for sce
Jan_sce = new((/46,88,88/),float)
Jan_sce at _FillValue = 9.9621e+36
Jan_sce at lat2d=lat
Jan_sce at lon2d=lon
;==========================================
do nyr=0,551,12
Jan_sce(nyr/12,:,:) =sce(nyr,:,:)
end do
Jan_reorder=Jan_sce(y|:,x|:,time|:)
Jan_dt=dtrend(Jan_reorder,False)
Jan_reorder at _FillValue = 9.9621e+36
corr_jan=escorc(Jan_dt,JJAS_1967_2012)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160216/cfcbe456/attachment.html
More information about the ncl-talk
mailing list