[ncl-talk] Interpolation error
Mary Haley
haley at ucar.edu
Fri Aug 8 07:37:42 MDT 2014
Hi Sun,
Thanks for providing the files. I consulted with Dennis offline about your
hyam/hybm values, and he stated the following:
[1] These look like sigma coordinates.
[2] p(k) = A(k)*PO + B(k)*PS
k=level, A(k)=>hyam=>pressure coord; B(k)=>sigma coord
Apparently, there are no pressure coords [ A(:)=0.0 ]
p(k) = B(k)*PS = sigma(k)*PS
[3] The vinth2p function requires the hybrid coefficients and data to be
top-of-atmos to bottom. These coefficients are bottom-to-top.
A sample hybm => sigma looks like the following.
Note the ordering. The fact that the #s are different is no big deal.
Just different sigma levels:
hybm = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0196774136275053,
0.062504293397069, 0.112887907773256, 0.172161616384983,
0.241894043982029, 0.323930636048317, 0.420442461967468,
0.524799540638924, 0.624887734651566, 0.713207691907883,
0.783669710159302, 0.831102818250656, 0.864811271429062,
0.896237164735794, 0.92512384057045, 0.951230525970459,
0.974335998296738, 0.992556095123291 ;
----------------------
The fix is to reorder your hyam and hybm values. You will also need to
reorder your data values in the level dimension:
hyam = filenc->a(::-1)
hybm = filenc->b(::-1)
ec550aer = data(:,::-1,:,:)
Please also review the documentation for vinth2p which talks about the
ordering required for all input variables:
http://www.ncl.ucar.edu/Document/Functions/Built-in/vinth2p.shtml
--Mary
On Thu, Aug 7, 2014 at 10:51 AM, Sunmin Park <mireiyue at gmail.com> wrote:
> Hi, Mary
>
> I uploaded the data files (start with “ec550aer_aero_NorESM1”) and script
> (CMIP5_ec,ncl). I checked the FillValue which is 1e+20 I tried with and
> without this part but the results showed same.
>
> Thank you
> Sun-
>
> On Aug 7, 2014, at 8:44 AM, Mary Haley <haley at ucar.edu> wrote:
>
> My first thought this looked like a _FillValue issue, but I can't tell
> simply from the output.
>
> Can you provide the data file for this script? You can use our ftp:
>
> http://www.ncl.ucar.edu/report_bug.shtml#HowToFTP
>
> Thanks,
>
> --Mary
>
>
>
> On Wed, Aug 6, 2014 at 3:16 PM, Sunmin Park <mireiyue at gmail.com> wrote:
>
>> Dear NCL users,
>>
>> I have a problem to do interpolation using NorESM1 model results. I am
>> using extinction coefficient values and when I read the data from the
>> files, the MIN and MAX values are
>> "(0) Ambient Aerosol Extinction at 550 nm: min=0 max=0.00242234 “
>> But after interpolation the values are
>> "(0) min=-2.58212e+22 max=0.0127834”
>>
>> I do not understand why the values are changing and the MIN value shows
>> minus. How can I fix it?
>>
>> Thank you for any help!!
>>
>> Sun-
>>
>> ; ==============================================================
>> ; Open the file:
>> ; ==============================================================
>> fili =
>> "ec550aer_aero_NorESM1-M_historicalExt_r1i1p1_200601-201212.nc"
>> ; fili = "ec550aer_aero_NorESM1-M_historicalExt_"+version(ii)+"
>> i1p1_200601-201212.nc"
>> varname = "ec550aer"
>> varname1 = "a"
>> varname2 = "b"
>> varname3 = "ps"
>> varname4 = "p0"
>> filenc = addfile (diri+fili+".nc", "r") ; entire file
>> ; printMinMax(varname,0)
>> ; print(varname1)
>> ; print(varname2)
>> ; print(varname3)
>> ; print(varname4)
>> ; print (filenc)
>> ; return
>>
>> data = filenc->$varname$ ; (time, ver, lat,
>> lon)
>> ; print (dimsizes(data))
>> time =filenc->time
>> lev =filenc->lev
>> lat =filenc->lat
>> printMinMax(data,0)
>> printVarSummary(data)
>> ;return
>> lon =filenc->lon
>> ; print(time)
>> ; print(lev)
>> ; print(lat)
>> ; print(lon)
>> ; data at _FillValue=1e+20
>> ; newlev =lev*1000
>> ; print(newlev)
>>
>> ;return
>>
>> ;############Converting from hybrid levels to standard pressure
>> levels######################################
>> hyam = filenc->a
>> hybm = filenc->b
>> plev0 =
>> (/1000,925,850,700,600,500,400,300,250,200,150,100,70,50,30,20,10/)
>> psfc = filenc->ps
>> p0=1000.
>>
>> ;printVarSummary(psfc)
>> ;printVarSummary(hyam)
>>
>> ec550aer = data;filenc->ec550aer ; read ec550aer from all
>> files
>> ec550aerNEW=vinth2p(ec550aer,hyam,hybm,plev0,psfc,1,p0,1,True)
>> delete(ec550aer)
>> ec550aer=ec550aerNEW
>> delete(ec550aerNEW)
>> printVarSummary(ec550aer)
>> printMinMax(ec550aer,0)
>> return
>>
>> ;###################################################################################
>>
>>
>> RESULTS
>>
>> (0) Ambient Aerosol Extinction at 550 nm: min=0 max=0.00242234
>>
>> Variable: data
>> Type: float
>> Total Size: 120766464 bytes
>> 30191616 values
>> Number of Dimensions: 4
>> Dimensions and sizes: [time | 84] x [lev | 26] x [lat | 96] x [lon |
>> 144]
>> Coordinates:
>> time: [15.5..2539.5]
>> lev: [0.9925560999999998..0.00354463800000001]
>> lat: [ -90.. 90]
>> lon: [ 0..357.5]
>> Number Of Attributes: 12
>> standard_name :
>> volume_extinction_coefficient_in_air_due_to_ambient_aerosol
>> long_name : Ambient Aerosol Extinction at 550 nm
>> comment : """ambient"" means ""wetted"". "
>> units : m-1
>> original_name : BAK
>> original_units : 1/km
>>
>>
>> Variable: ec550aer
>> Type: float
>> Total Size: 78962688 bytes
>> 19740672 values
>> Number of Dimensions: 4
>> Dimensions and sizes: [time | 84] x [lev_p | 17] x [lat | 96] x [lon |
>> 144]
>> Coordinates:
>> time: [15.5..2539.5]
>> lev_p: [1000..10]
>> lat: [ -90.. 90]
>> lon: [ 0..357.5]
>> Number Of Attributes: 1
>> _FillValue : 1e+20
>> (0) min=-2.58212e+22 max=0.0127834
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140808/0e2d8955/attachment.html
More information about the ncl-talk
mailing list