# [ncl-talk] Interpolation to specific height levels

ali mughal mughalali655 at gmail.com
Mon Jun 21 02:09:56 MDT 2021

```Dear Dennis and all

I have rewritten the code (please see attached) to obtain the value of
TA_MEAN at respective station heights. I am assuming it is correct since I
am subtracting the terrain height. Please let me know if you think that the
logic is incorrect.
The issue  is that the RMSE of WRF extracted values against observations
increased on all stations. I was expecting that when the temperature is
interpolated at the correct height it will reduce the RMSE instead of
increasing it. When I am extracting the value of temperature at the first
eta level the RMSE was less. Any help would be greatly appreciated.

I asked a similar question  but nobody answered the following question. I
think this is extremely important when doing data analysis using NCL
https://mailman.ucar.edu/pipermail/ncl-talk/2021-March/017963.html

I would be grateful to all for support and suggestions

On Sat, Jun 19, 2021 at 3:05 PM ali mughal <mughalali655 at gmail.com> wrote:

> Dear Dennis
>
> Thank you for the response. Please see the following output from the
> statement print("it="+it+"  nlt="+nlt+"  nln="+nln+" nlev="+nlev)
>
> (0)     it=0  nlt=1  nln=80 nlev=6
> (0)     it=0  nlt=85  nln=154 nlev=27
>
> which is correct according to what is required, however, not sure why "it"
> remains 0.
>
> The following is the output of prinVarSummary for ta_interp which is also
> correct.
>
> Variable: ta_interp
> Type: float
> Total Size: 572682600 bytes
>             143170650 values
> Number of Dimensions: 4
> Dimensions and sizes:   [Time | 755] x [interp_levels | 7] x [south_north
> | 129]                     x [west_east | 210]
> Coordinates:
>             interp_levels: [6..15]
> Number Of Attributes: 8
>   _FillValue :  9.96921e+36
>   FieldType :   104
>   MemoryOrder : XYZ
>   description : T Abs. Mean
>   units :       K
>   stagger :
>   coordinates : XLONG XLAT XTIME
>   vert_interp_type :    theta
>
> The total number of the eta levels (vertical levels) in the wrfout file
> were 51. I needed to interpolate the values to exact heights of the seven
> stations as I mentioned before as some of the stations lie above the height
> of 1st vertical level. The first level is at 5.5 m height.
>
>
>
>
>
>
> On Sat, Jun 19, 2021 at 3:03 AM Dennis Shea <shea at ucar.edu> wrote:
>
>> 120       alist = [/times(it),lat1,lon1,ta_interp(it,nlev,nlt,nln)/]   ;
>> Store data to be written in a list.
>> =============
>> fatal:Subscript out of range, error in subscript #1
>>
>> Subscript #1 of ta_interp(it,*nlev*,nlt,nln) is "nlev"    [ subscript
>> numbers: (0,1,2,3) ]
>>
>> When you get this type of error, use print statements prior to the
>> offending statement:
>>
>> print("it="+it+"  nlt="+nlt+"  nln="+nln+" nlev="+nlev)
>> alist = [/times(it),lat1,lon1,ta_interp(it,nlev,nlt,nln)/]
>> =====
>>
>> After the computation of 'ta_interp' add a printVarSummary:
>>
>>    ta_interp = wrf_user_vert_interp(a,ta_mean,vert_coord,lev,opts)
>>    printVarSummary(ta_interp)
>>
>> This will give you the variable dimension information.
>>
>>
>>
>>
>>
>>
>>
>>
>> On Thu, Jun 17, 2021 at 11:53 PM ali mughal via ncl-talk <
>> ncl-talk at mailman.ucar.edu> wrote:
>>
>>> Dear All
>>>
>>> I am trying to obtain values of temperature at seven specific station
>>> locations and their respective heights. To do so, I have modified the
>>> script write_csv 5.ncl according to my usage.
>>> But I am getting the following error at line
>>> fatal:Subscript out of range, error in subscript #1
>>> fatal:An error occurred reading ta_interp
>>> fatal:["Execute.c":8637]:Execute: Error occurred at or near line 120 in
>>> file write_TA_MEAN_intrp.ncl
>>>
>>> Can someone kindly guide me on what I can correct so that I can get the
>>> required values at respective heights and location of the stations ?
>>>
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at mailman.ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210621/8a5bd966/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: new_Test_interp.ncl
Type: application/octet-stream
Size: 1838 bytes
Desc: not available
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210621/8a5bd966/attachment.obj>
```