[ncl-talk] TKE vs time and height, wrf_user_intrp3d doesn't work
Bill Ladwig
ladwig at ucar.edu
Tue Nov 6 11:10:31 MST 2018
I think it will work if you get z on the staggered vertical grid. Instead
of using wrf_user_getvar to get 'z', just compute the staggered z yourself
(it's easy).
ph = wrf_user_getvar(f, "PH", -1)
> phb = wrf_user_getvar(f, "PHB", -1)
> z_stag = (PH + PHB)/9.81
You can then use this as your height variable for your TKE interpolation.
tke_full = wrf_user_intrp3d(tke, z_stag, "h", height, 0., False)
Alternatively, you could unstagger TKE to the mass grid using
wrf_user_unstagger (see
https://www.ncl.ucar.edu/Document/Functions/WRF_arw/wrf_user_unstagger.shtml).
Your choice.
Hope this helps,
Bill
On Tue, Nov 6, 2018 at 10:33 AM Mary Haley <haley at ucar.edu> wrote:
> Alina,
>
> Sorry, I missed that this message was directed at me specifically.
>
> The link you provided is bad. Did you ever get help from MMM on the
> issue? They are really the folks that should be answering this question.
> NCL doesn't currently have a WRF function to do an interpolation on a
> variable that has a different number of levels than the level array itself.
>
> --Mary
>
>
> On Sat, Oct 27, 2018 at 10:20 AM, Schuster Alina <436803016250 at yandex.ru>
> wrote:
>
>> Dear Mary,
>>
>> Thank you very much for the reply. I still need to solve this problem
>> (was just distracted by other urgent matters). I have posted this question
>> on http://forum.mmm.ucar.edu/phpBB3/viewtopic.php?f=49&t=330 . May be
>> you or colleques could look into it?
>> Thank you very much for your help.
>>
>> Best regards,
>> Alina Schuster
>>
>>
>> 19.10.2018, 17:22, "Mary Haley" <haley at ucar.edu>:
>>
>> Ehsan,
>>
>> The problem is that the tke variable has one more level than the z
>> variable because it's on a staggered set of levels and the "z" array you
>> gave it is not. The wrf_user_intrp3d routine only works on a z array
>> with the same number of levels.
>>
>> To be clear, the purpose of wrf_user_intrp3d is not to interpolate from
>> one set of levels to another, but rather to interpolate a 3D grid onto a 2D
>> plane. This requires that you do this using the same vertical levels that
>> define the vertical dimension of your 3D grid. You should look on your WRF
>> output file to find the 1D vertical levels of length bottom_top_stag (31)
>> that represent the levels of TKE.
>>
>> If you still need help with this, then I suggest writing to the new WRF
>> help forum:
>>
>> http://forum.mmm.ucar.edu/phpBB3/
>>
>> You'll see a link to "Post-processing/Utilities" and you can post your
>> question there.
>>
>> Good luck,
>>
>> --Mary
>>
>>
>> On Tue, Oct 16, 2018 at 12:22 PM, Ehsan Taghizadeh <
>> ehsantaghizadeh at yahoo.com> wrote:
>>
>>
>> Dear Mary,
>>
>> I have same problem as Alina. May I answer your question about
>> printVarSummary(z,tke)?
>> Following are the answers:
>>
>>
>> Variable: tke
>> Type: float
>> Total Size: 1008886320 bytes
>> 252221580 values
>> Number of Dimensions: 4
>> Dimensions and sizes: [Time | 61] x [bottom_top_stag | 31] x
>> [south_north | 342] x [west_east | 390]
>> Coordinates:
>> Number Of Attributes: 6
>> FieldType : 104
>> MemoryOrder : XYZ
>> description : TKE from PBL
>> units : m2 s-2
>> stagger : Z
>> coordinates : XLONG XLAT XTIME
>>
>> Variable: z
>> Type: float
>> Total Size: 976341600 bytes
>> 244085400 values
>> Number of Dimensions: 4
>> Dimensions and sizes: [Time | 61] x [bottom_top | 30] x [south_north |
>> 342] x [west_east | 390]
>> Coordinates:
>> Number Of Attributes: 6
>> coordinates : XLONG XLAT
>> stagger :
>> units : m
>> description : Height
>> MemoryOrder : XYZ
>> FieldType : 104
>> It seems the only difference is about (bottom_top) and (bottom_top_stag)
>> dimension names.
>> I think "wrf_user_interp3d" doesn't work for TKE_PBL? I also used this
>> script (
>> http://www2.mmm.ucar.edu/wrf/OnLineTutorial/Graphics/NCL/Examples/LEVELS_INTERP/wrf_Height2.ncl)
>> for "TKE_PBL" variable of WRF, but same error has occured:
>>
>> "mension size mismatch, dimension (1) of left hand side reference does
>> not have the same size as the right hand side reference after subscripting.
>> "
>>
>> Sincerely
>> Ehsan
>>
>> On Tuesday, October 16, 2018, 9:31:43 PM GMT+3:30, Mary Haley <
>> haley at ucar.edu> wrote:
>>
>>
>> Hi Alina,
>>
>> I'm guessing that the error is in how wrf_user_intrp3d is being called.
>> If you look at the documentation:
>>
>> http://www.ncl.ucar.edu/Document/Functions/WRF_arw/wrf_user_intrp3d.shtml
>>
>> and read the section on input arguments, it takes that the first two
>> input arrays must be the same size, which in your case is tke and z. Did
>> you do a printVarSummary on z to see what size it is?
>>
>> --Mary
>>
>>
>> On Thu, Oct 11, 2018 at 9:41 AM, Schuster Alina <
>> alina-galchenko at yandex.ru> wrote:
>>
>>
>> Dear colleagues!
>>
>> I am using a scm wrf model (an idealised case) and need to plot a
>> variable TKE (turbulent kinetic energy) vs time and height. But I get an
>> error
>>
>> fatal:Dimension size mismatch, dimension (1) of left hand side reference
>> does not have the same size as the right hand side reference after
>> subscripting.
>> fatal:["Execute.c":8640]: Execute: Error occurred at or near line 246 in
>> file /home/alina/NCL64/lib/ncarg/ nclscripts/wrf/WRFUserARW.ncl
>>
>> fatal:["Execute.c":8640]: Execute: Error occurred at or near line 29 in
>> file TKE.ncl
>>
>> I don't know how to fix it.
>>
>> Line 246 contains:
>> if ( nd .eq. 4 ) then
>> var3(0,:,:,:,:) = var3d(:,:,:,:)
>> z(0,:,:,:,:) = z_in(:,:,:,:)
>> end if
>>
>> Don't know what's wrong. It can be the problem is with the variable TKE
>> and its 4 dimensions:
>> Variable: tke
>> Type: float
>> Total Size: 57600 bytes
>> 14400 values
>> Number of Dimensions: 4
>> Dimensions and sizes: [Time | 60] x [bottom_top_stag | 60] x [south_north
>> | 2] x [west_east | 2]
>> Coordinates:
>> Time: [ 0.. 59]
>> Number Of Attributes: 6
>> FieldType : 104
>> MemoryOrder : XYZ
>> description : TKE from PBL
>> units : J
>> stagger : Z
>> coordinates : XLONG XLAT XTIME
>>
>> May be someone could advise me an alternative to the command
>> wrf_user_intrp3d or may be someone has a ready script for TKE vs height and
>> time (gsn_csm_contour).
>> Thanks in advance!
>>
>> Best Regards,
>> Alina Schuster
>>
>> ______________________________ _________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/ mailman/listinfo/ncl-talk
>> <http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>> ,
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>>
>> --
>> Best Regards,
>> Alina Schuster
>>
>>
>
> _______________________________________________
> 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/20181106/2770732b/attachment.html>
More information about the ncl-talk
mailing list