[ncl-talk] Interpolate WRF eta levels to pressure levels
Dennis Shea
shea at ucar.edu
Wed Jan 8 14:44:11 MST 2020
I am not sure what you expect.
You specified:
po=(/1000,925,850,700,600,500,400,300,250,200,150,100/)
(0) 1.25481 981.047 *< lowest level at selected grid point*
(1) 1.24344 973.034
(2) 1.21865 962.199
(3) 1.17586 948.54
(4) *1.12176 931.583*
(1) *1.10414 925 <==
interpolated value*
(5) *1.06503 910.392*
====
The function is working correctly.
If the largest values are at > 1000hPa, you are *not* going get those values
On Wed, Jan 8, 2020 at 11:48 AM Anahita Amiri Farahani <aamir003 at ucr.edu>
wrote:
> Hi Dennis,
>
> The highest values are at the lowest level of the model, here is the
> result:
>
>
> ncl 44> print(pm10(nt,:,nl,ml)+" "+pp(nt,:,nl,ml)) ; original values
>
> (0) 1.25481 981.047
>
> (1) 1.24344 973.034
>
> (2) 1.21865 962.199
>
> (3) 1.17586 948.54
>
> (4) 1.12176 931.583
>
> (5) 1.06503 910.392
>
> (6) 1.00965 884.963
>
> (7) 0.944906 852.784
>
> (8) 0.839258 815.761
>
> (9) 0.12149 778.829
>
> (10) 6.40826e-05 741.971
>
> (11) 7.4096e-09 690.793
>
> (12) 1.67003e-08 627.743
>
> (13) 1.82599e-09 569.472
>
> (14) 7.36256e-09 515.695
>
> (15) 1.00853e-10 466.13
>
> (16) 2.71609e-12 420.504
>
> (17) 2.44285e-12 378.548
>
> (18) 2.11262e-12 339.999
>
> (19) 1.66884e-12 304.627
>
> (20) 1.57059e-12 272.216
>
> (21) 3.7027e-12 242.565
>
> (22) 3.73469e-12 215.484
>
> (23) 1.28918e-12 190.795
>
> (24) 1.16618e-12 168.325
>
> (25) 1.22242e-12 148.139
>
> (26) 1.23782e-12 130.317
>
> (27) 1.2826e-12 114.653
>
> (28) 1.38395e-12 100.887
>
> (29) 1.52224e-12 88.7878
>
> (30) 1.42968e-12 78.1545
>
> (31) 1.25225e-12 68.8088
>
> (32) 1.10018e-12 60.5953
>
> (33) 9.62732e-13 53.3767
>
> ncl 45> print("-----")
>
> (0) -----
>
> ncl 46> print(To(nt,:,nl,ml)+" "+po)
>
> (0) 9.96921e+36 1000
>
> (1) 1.10414 925
>
> (2) 0.936961 850
>
> (3) 1.15346e-05 700
>
> (4) 9.6186e-09 600
>
> (5) 5.06314e-09 500
>
> (6) 2.58256e-12 400
>
> (7) 1.65481e-12 300
>
> (8) 3.16807e-12 250
>
> (9) 2.20098e-12 200
>
> (10) 1.21723e-12 150
>
> (11) 1.39409e-12 100
>
>
>
> Thanks,
>
> Ana
>
> On Wed, Jan 8, 2020 at 1:32 PM Dennis Shea <shea at ucar.edu> wrote:
>
>> re: "The max size is much smaller than original pm10. "
>>
>> How carefully did you look to see why this may occur?
>> Are the larger pm10 values outside the 1000 and 100 hPa Levels?
>>
>> Pick a grid point
>>
>> nt = 7
>> nl = 45
>> ml = 60
>>
>> print(pm10(nt,:,nl,ml)+" "+pp(nt,:,nl,ml)) ; original values
>> print("-----")
>>
>> ============
>>
>> To = int2p_n_Wrap (pp,pm10,po,1,1)
>> ;
>> :
>> print(To(nt,:,nl,ml)+" "+po) ; interpolated values at specified
>> pressure levels
>>
>> Do the values look correct?
>>
>> On Wed, Jan 8, 2020 at 9:08 AM Anahita Amiri Farahani <aamir003 at ucr.edu>
>> wrote:
>>
>>> So you mean this:
>>>
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
>>>
>>> ana=addfile("wrfout_d01_2015-08-13","r")
>>> ;ana=addfile("wrfout_d01_2015-08-13_00:00:00","r")
>>> lat1=ana->XLAT(0,:,0)
>>> lon1=ana->XLONG(0,0,:)
>>> P=ana->P
>>> pm10=ana->PM10
>>> pp = wrf_user_getvar(ana, "pressure",-1)
>>> delete(ana)
>>>
>>> printVarSummary(pm10)
>>> printMinMax(pm10,0)
>>> print("====")
>>> printVarSummary(P)
>>> printMinMax(P,0)
>>> print("====")
>>>
>>>
>>> po=(/1000,925,850,700,600,500,400,300,250,200,150,100/);*100.0
>>> po!0 = "po"
>>> po at long_name = "Pressure Level"
>>> po at units = "hPa"
>>>
>>> To = int2p_n_Wrap (pp,pm10,po,1,1)
>>> printVarSummary(To)
>>> printMinMax(To,0)
>>> print("====")
>>>
>>>
>>> and I have this:
>>>
>>> Variable: To
>>>
>>> Type: float
>>>
>>> Total Size: 4678560 bytes
>>>
>>> 1169640 values
>>>
>>> Number of Dimensions: 4
>>>
>>> Dimensions and sizes: [Time | 9] x [po | 12] x [south_north | 95] x
>>> [west_east | 114]
>>>
>>> Coordinates:
>>>
>>> po: [1000..100]
>>>
>>> Number Of Attributes: 7
>>>
>>> _FillValue : 9.96921e+36
>>>
>>> FieldType : 104
>>>
>>> MemoryOrder : XYZ
>>>
>>> description : pm10 dry mass
>>>
>>> units : ug m^-3
>>>
>>> stagger :
>>>
>>> coordinates : XLONG XLAT XTIME
>>>
>>> ncl 32> printMinMax(To,0)
>>>
>>> (0) pm10 dry mass (ug m^-3) : min=0 max=32.0972
>>>
>>> ncl 33> print("====")
>>>
>>> (0) ====
>>>
>>>
>>>
>>> The max size is much smaller than original pm10.
>>>
>>>
>>> Thanks,
>>>
>>> Ana
>>>
>>> On Wed, Jan 8, 2020 at 10:59 AM Dennis Shea <shea at ucar.edu> wrote:
>>>
>>>> Yes.
>>>>
>>>> Sent from my iPhone
>>>>
>>>> On Jan 8, 2020, at 8:32 AM, Anahita Amiri Farahani <aamir003 at ucr.edu>
>>>> wrote:
>>>>
>>>>
>>>> Hi Dennis,
>>>>
>>>> I tried this, but it gives me missing values:
>>>>
>>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
>>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
>>>>
>>>> ana=addfile("wrfout_d01_2015-08-13","r")
>>>>
>>>> lat1=ana->XLAT(0,:,0)
>>>> lon1=ana->XLONG(0,0,:)
>>>> P=ana->P
>>>> pm10=ana->PM10
>>>> delete(ana)
>>>>
>>>> printVarSummary(pm10)
>>>> printMinMax(pm10,0)
>>>> print("====")
>>>> printVarSummary(P)
>>>> printMinMax(P,0)
>>>> print("====")
>>>>
>>>>
>>>> po=(/1000,925,850,700,600,500,400,300,250,200,150,100/)*100.0
>>>> po!0 = "po"
>>>> po at long_name = "Pressure Level"
>>>> po at units = "Pa"
>>>>
>>>> To = int2p_n_Wrap (P,pm10,po,1,1)
>>>> printVarSummary(To)
>>>> printMinMax(To,0)
>>>> print("====")
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Variable: pm10
>>>>
>>>> Type: float
>>>>
>>>> Total Size: 13255920 bytes
>>>>
>>>> 3313980 values
>>>>
>>>> Number of Dimensions: 4
>>>>
>>>> Dimensions and sizes: [Time | 9] x [bottom_top | 34] x [south_north |
>>>> 95] x [west_east | 114]
>>>>
>>>> Coordinates:
>>>>
>>>> Number Of Attributes: 6
>>>>
>>>> FieldType : 104
>>>>
>>>> MemoryOrder : XYZ
>>>>
>>>> description : pm10 dry mass
>>>>
>>>> units : ug m^-3
>>>>
>>>> stagger :
>>>>
>>>> coordinates : XLONG XLAT XTIME
>>>>
>>>> (0) pm10 dry mass (ug m^-3) : min=0 max=183.558
>>>>
>>>> (0) ====
>>>>
>>>>
>>>> Variable: P
>>>>
>>>> Type: float
>>>>
>>>> Total Size: 13255920 bytes
>>>>
>>>> 3313980 values
>>>>
>>>> Number of Dimensions: 4
>>>>
>>>> Dimensions and sizes: [Time | 9] x [bottom_top | 34] x [south_north |
>>>> 95] x [west_east | 114]
>>>>
>>>> Coordinates:
>>>>
>>>> Number Of Attributes: 6
>>>>
>>>> FieldType : 104
>>>>
>>>> MemoryOrder : XYZ
>>>>
>>>> description : perturbation pressure
>>>>
>>>> units : Pa
>>>>
>>>> stagger :
>>>>
>>>> coordinates : XLONG XLAT XTIME
>>>>
>>>> (0) perturbation pressure (Pa) : min=0.702637 max=2079.95
>>>>
>>>> (0) ====
>>>>
>>>>
>>>> Variable: To
>>>>
>>>> Type: float
>>>>
>>>> Total Size: 4678560 bytes
>>>>
>>>> 1169640 values
>>>>
>>>> Number of Dimensions: 4
>>>>
>>>> Dimensions and sizes: [Time | 9] x [po | 12] x [south_north | 95] x
>>>> [west_east | 114]
>>>>
>>>> Coordinates:
>>>>
>>>> po: [100000..10000]
>>>>
>>>> Number Of Attributes: 7
>>>>
>>>> _FillValue : 9.96921e+36
>>>>
>>>> FieldType : 104
>>>>
>>>> MemoryOrder : XYZ
>>>>
>>>> description : pm10 dry mass
>>>>
>>>> units : ug m^-3
>>>>
>>>> stagger :
>>>>
>>>> coordinates : XLONG XLAT XTIME
>>>>
>>>> (0) pm10 dry mass (ug m^-3) : min=9.96921e+36 max=9.96921e+36
>>>>
>>>> (0) ====
>>>>
>>>>
>>>> P is the perturbation pressure, should I use pressure instead?
>>>>
>>>> Thanks,
>>>> Ana
>>>>
>>>>
>>>>
>>>> On Tue, Jan 7, 2020 at 11:14 PM Dennis Shea <shea at ucar.edu> wrote:
>>>>
>>>>> ***If*** the WRF file has a variable
>>>>> P(Time,bottom_top,south_north,west_east)
>>>>> then those are the pressure levels at each 'eta' coordinate at each
>>>>> grid point and time.
>>>>>
>>>>> If say you want to interpolate the variable
>>>>> T(Time,bottom_top,south_north,west_east)
>>>>> then something like:
>>>>> T = f->T
>>>>> P = f->P
>>>>> printVarSummary(T)
>>>>> printMinMax(T,0)
>>>>> print("====")
>>>>> printVarSummary(P)
>>>>> printMinMax(P,0)
>>>>> print("====")
>>>>>
>>>>> po = (/1000,900,850,700,600,500,400,300,200,100,50,10,5/)*100.0
>>>>> po!0 = "po"
>>>>> po at long_name = "Pressure Level"
>>>>> po at units = "Pa"
>>>>>
>>>>> To =* int2p_n_Wrap*
>>>>> <http://www.ncl.ucar.edu/Document/Functions/Contributed/int2p_n_Wrap.shtml>
>>>>> (P,T,po,1,1)
>>>>> printVarSummary(To)
>>>>> printMinMax(To,0)
>>>>> print("====")
>>>>> ====
>>>>> If P is not on the WRF file, then you will have to get help from WRF
>>>>> support.
>>>>>
>>>>>
>>>>>
>>>>> On Tue, Jan 7, 2020 at 9:12 AM Anahita Amiri Farahani via ncl-talk <
>>>>> ncl-talk at ucar.edu> wrote:
>>>>>
>>>>>> Hi all,
>>>>>>
>>>>>> Is there any function/command in NCL to convert WRF eta levels to
>>>>>> pressure levels?
>>>>>>
>>>>>> Thanks,
>>>>>> Ana
>>>>>> _______________________________________________
>>>>>> ncl-talk mailing list
>>>>>> ncl-talk at ucar.edu
>>>>>> 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/20200108/003e5c2f/attachment.html>
More information about the ncl-talk
mailing list