Commit 51d04379 authored by Carl Schreck's avatar Carl Schreck
Browse files

Automated Nightly Commit - Wed Oct 31 00:00:27 EDT 2018

parent 833f0b61
......@@ -9,20 +9,29 @@ function percent_to_value_2d( \
i_data[*][*][*] : numeric, \
i_percentile[1] : numeric \
)
local None
begin
return( percent_to_value_nd( i_data, i_percentile ) )
end
dims = dimsizes(i_data)
sorted = i_data
ip = dim_pqsort_n( sorted, 2, 0 )
pInd = round( i_percentile * .01 * dims(0) + 0.5, 3 ) -1
pInd = where( pInd.ge.dims(0), dims(0)-1, pInd )
retVal = sorted(pInd,:,:)
copy_VarAtts( i_data, retVal )
copy_VarCoords( i_data(0,:,:), retVal )
return(retVal)
end ; percent_to_value_2d
;undef ( "percent_to_value_2d" )
;function percent_to_value_2d( \
; i_data[*][*][*] : numeric, \
; i_percentile[1] : numeric \
;)
;local None
;begin
;
; dims = dimsizes(i_data)
; sorted = i_data
; ip = dim_pqsort_n( sorted, 2, 0 )
;
; pInd = round( i_percentile * .01 * dims(0) + 0.5, 3 ) -1
; pInd = where( pInd.ge.dims(0), dims(0)-1, pInd )
; retVal = sorted(pInd,:,:)
; copy_VarAtts( i_data, retVal )
; copy_VarCoords( i_data(0,:,:), retVal )
;
; return(retVal)
;end ; percent_to_value_2d
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; percent_to_value_nd.ncl
; Carl Schreck (cjschrec@ncsu.edu)
; January 2015
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
undef ( "percent_to_value_nd" )
function percent_to_value_nd( \
i_data : numeric, \
i_percentile[*] : numeric \
)
local None
begin
dims = dimsizes(i_data)
nDims = dimsizes(dims)
sorted = i_data
ip = dim_pqsort_n( sorted, 2, 0 )
pInd = round( i_percentile * .01 * dims(0) + 0.5, 3 ) -1
pInd = where( pInd.ge.dims(0), dims(0)-1, pInd )
if( nDims.eq.2 ) then
retVal = sorted(pInd,:)
elseif( nDims.eq.3 ) then
retVal = sorted(pInd,:,:)
elseif( nDims.eq.4 ) then
retVal = sorted(pInd,:,:,:)
elseif( nDims.eq.5 ) then
retVal = sorted(pInd,:,:,:,:)
elseif( nDims.eq.6 ) then
retVal = sorted(pInd,:,:,:,:,:)
end if
copy_VarAtts( i_data, retVal )
if( dimsizes(i_percentile).gt.1 ) then
retVal!0 = "ptile"
retVal&ptile = i_percentile
end if
do d = 1, nDims-1
dimName = i_data!d
if( dimsizes(i_percentile).gt.1 ) then
retVal!d = dimName
else
retVal!(d-1) = dimName
end if
retVal&$dimName$ = i_data&$dimName$
end do
return(retVal)
end ; percent_to_value_nd
......@@ -36,6 +36,7 @@ load "$CJS_NCL_LIB/array/serial_average.ncl"
load "$CJS_NCL_LIB/array/percent_to_value.ncl"
load "$CJS_NCL_LIB/array/print_ptiles.ncl"
load "$CJS_NCL_LIB/array/percent_to_value_nd.ncl"
load "$CJS_NCL_LIB/array/percent_to_value_2d.ncl"
load "$CJS_NCL_LIB/array/signif_diff_percentiles.ncl"
load "$CJS_NCL_LIB/array/value_to_percent.ncl"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment