Re: Interpolating sounding data to a height grid

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed Jun 04 2014 - 07:58:57 MDT

I am not sure if anyone has answered this question.

[1] There is an issue with the data file's (raob_soundings0523_12Z.cdf)
     missing_value attribute and the variables with which it
     is associated.

     Note: **The source file has only the missing_value attribute.**
     When NCL encounters a variable with a missing_value attribute
     and no corresponding _FillValue, NCL with add a 'virtual
     _FillValue attribute' because _FillValue is what NCL recognizes
     for missing values.

ncl 0> f = addfile("raob_soundings0523_12Z.cdf","r")
ncl 1> tpMan = f->tpMan
ncl 2> print(tpMan)

Variable: tpMan
Type: float
Total Size: 88 bytes
             22 values
Number of Dimensions: 2
Dimensions and sizes: [recNum | 1] x [manLevel | 22]
Coordinates:
Number Of Attributes: 5
   long_name : Temperature - Mandatory level
   units : kelvin
   valid_range : ( 173, 373 )
   missing_value : 99999 <=== original attribute
   _FillValue : 99999 <=== virtual attribute

(0,0) 290.4
(0,1) 99999 <===
(0,2) 290.8
(0,3) 288.4
(0,4) 280.6
(0,5) 259.7
(0,6) 249.7
(0,7) 234.1
(0,8) 223.7
(0,9) 213.1
(0,10) 205.5
(0,11) 212.9
(0,12) 208.1
(0,13) 214.9
(0,14) 220.1
(0,15) 223.1
(0,16) 233.7
(0,17) 9.96921e+36 <====
(0,18) 9.96921e+36
(0,19) 9.96921e+36
(0,20) 9.96921e+36
(0,21) 9.96921e+36

At this point, the 9.96921e+36 values are not treated in
any special manner. They are considered valid data.
One approach ....

ncl 5> tpMan = where(tpMan.gt.1e20, tpMan@_FillValue, tpMan)
ncl 6> print(tpMan)

Variable: tpMan
Type: float
Total Size: 88 bytes
             22 values
Number of Dimensions: 2
Dimensions and sizes: [recNum | 1] x [manLevel | 22]
Coordinates:
Number Of Attributes: 5
   long_name : Temperature - Mandatory level
   units : kelvin
   valid_range : ( 173, 373 )
   missing_value : 99999
   _FillValue : 99999
(0,0) 290.4
(0,1) 99999
(0,2) 290.8
(0,3) 288.4
(0,4) 280.6
(0,5) 259.7
(0,6) 249.7
(0,7) 234.1
(0,8) 223.7
(0,9) 213.1
(0,10) 205.5
(0,11) 212.9
(0,12) 208.1
(0,13) 214.9
(0,14) 220.1
(0,15) 223.1
(0,16) 233.7
(0,17) 99999
(0,18) 99999
(0,19) 99999
(0,20) 99999
(0,21) 99999

====
That said ... the following may be a better approach

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"

undef("fix_variable")
function fix_variable(f[1]:file, varName[1]:string, nt[1]:integer)
begin
     x = f->$varName$(nt,:)
     ibig = ind(x.gt.1e20)
     xnew = x(:ibig(0)-1) ; all values less than 1e20
     return(xnew)
end

         z= addfile("raob_soundings0523_12Z.cdf","r")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  n = 0 ;Choose a time
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; *****Sounding Data*****
         T = fix_variable(z, "tpSigT", n)
         h1 = fix_variable(z, "htSigT", n)
         print("---")
         print(h1+" "+T)

         h_new = ispan(0,3000,100)

         temperature_sounding = linint1_n_Wrap (h1,T, False, h_new, 0, 0)

         print("---")
         print(temperature_sounding)
         print("---")
         print(h_new+" "+temperature_sounding)

On 5/27/14, 3:50 PM, brianjs @iastate.edu wrote:
> Good Afternoon,
>
> I have a small (and possibly simple) question to ask. I am attempting to
> develop vertical profiles of potential temperature, total wind speed
> magnitude, and atmospheric water vapor content for the 100-3000 meter
> layer, at 100 meter intervals from sounding data available in netcdf
> format). I attempted to interpolate it to the given levels I want with
> the linint1_n_Wrap command, but all I get are missing values. I am not sure
> why this happens, as plugging in model or other forms of gridded
> data/output work just fine with this same routine. I am guessing the
> sounding data is not organized the way it appears to be? Has anyone had
> this issue before? I appreciate any input as to why the data goes missing.
>
> I have attached my code and one of the input sounding data files. Thank you
> in advance!
>
> Brian Squitieri
> Graduate Research Assistant
> Iowa State University
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Jun 04 07:59:06 2014

This archive was generated by hypermail 2.1.8 : Sat Jun 07 2014 - 11:03:12 MDT