begin ;;;;;;;;;;;Read model;;;;;;;;;;;;;;;;;;;;; nfile="obs.csv" ines = asciiread (nfile, -1, "string") ; -1 means read whole file ;print(ines) ; echo input strs1 = str_split_csv (ines, ",", 0) k1 = tofloat (strs1) ; _FillValue = 9.96921e+36 k1@_FillValue = -9999.0 ; change to 'nicer' _FillValue step1=(dimsizes(k1(:,0))) ;print(step1) ;;;;;;Read model;;;;;;;;;;;;;;;; infile = "test.csv" lines = asciiread (infile, -1, "string") ; -1 means read whole file print(lines) ; echo input strs = str_split_csv (lines, ",", 0) k = tofloat (strs) ; _FillValue = 9.96921e+36 k@_FillValue = -9999.0 ; change to 'nicer' _FillValue step=(dimsizes(k(:,0))) ;print(step) yp=k(:,0);;;;ORiginal model yp1=k1(:,0);;;;Original obs ;print(yp) print(yp1) ;print(step);; ;print(step1);;;;obs y=9;;;;;maximum size of the array;;;;y-1 numbers lost ;;when you want to test test entire length(t=0);;;; c=y-1;;;;;;;;;;Important to note;;;when entire row considered st=(step-1)-c do i=0,st nums1=k1(i:i+c,0);;;;;;;observtion nums=k(i:i+c,0);;;;;;;;model ;end do ;print(nums) ;;;;;;;;;;;;Original data;;;;;;;;;;;; OrigObs=nums1 ;;;;;;;;;;in window;;obssssssservation;;;;;; OrigModel1=nums ;;;;;;;;;;in window;model; ;print(OrigObs) ;print(nums) rank =(dimsizes(nums)) ;print(rank) ;print(rank/2) ;;;mid value of original array;;;;; midOrig=nums(rank/2);;;;;;;;;;Model ;print(midOrig) year_want = (/midOrig/) ;;;;Sorted data;;;;;;;;;;; qsort(nums);;;;;;;;;;very cautious after this line qsort(nums1);;;;;;;;;;very cautious after this line ;print(nums) yu=(nums);;;;;;;;;;;;;;;;;;;;sorted data yu1=(nums1);;;;;;;;;;;;;;;;;;;;sorted data ;print(yu) ;print(xmodel);;;;;;;;;;;;;;;cdf ;;;;;;define the number I want ;print(year_want) ;print(xmodel) ;print(yu) ;print(year_want) ;;;;;picking the indices;;;;;;;;;;;;; indi = get1Dindex(yu,year_want) ;print(indi) arraycdfinverse=yu1(indi) print(arraycdfinverse) OrigMod=new(st+1,float,yu@_FillValue) do i=0,st OrigMod(i)=arraycdfinverse end do end do asciiwrite("foo", OrigMod) return end