[ncl-talk] Error- wrf model output wind plot

Dennis Shea shea at ucar.edu
Wed Dec 6 11:07:35 MST 2017


I do not have your WRF file so I used a local file:
wrfout_d02_2011-01-18_00:00:00.nc
It has only one time step (it=0) and dimension sizes different than your
but it can be for illustration.

;;filename = "/home/gaurav/wrf_exp/wrfout_d02_2014-10-26_00:00:
00-fnl-myjbmj.nc"
;;a        = addfile(filename,"r")
;;it  = 07
;---Open WRF output file
  filename = "./wrfout_d02_2011-01-18_00:00:00.nc"   ; LOCAL FILE
  a        = addfile(filename,"r")
  it  =
0
; ONE TIME STEP

===
The WRF model uses 'terrain following' vertical coordinates. Hence, the
pressure levels at each grid point vary. You have:

  pressure_level   = (/ 850./)   ; pressure levels to plot
  nlevels               = dimsizes(pressure_level)     ; number of pressure
levels
  p                        = wrf_user_getvar(a, "pressure",it)
  *printVarSummary(p)     ; <=== I added this!*

====
Variable: p
Type: float
Total Size: 7830000 bytes
            1957500 values
Number of Dimensions: 3
Dimensions and sizes:   * [bottom_top | 27] x [south_north | 250] x
[west_east | 290]*
====

Then you have the following which *only* makes sense
*if you have interpolated to 850 hPa (isobaric level)*

*and created new u and v at the interpolated level(s): say up and vp. I
believe WRF has functions for this. Please read about this.*

nlevels                  = dimsizes(pressure_level)     ; number of
pressure levels
 do level                 = 0,nlevels-1
  pressure                 = pressure_level(level)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    if ( pressure .eq. 850 ) then      * ; only if you have interpolated*
          contour                         = wrf_contour(a,wks,
*up(level,:,:)*,opts)
          plot                             =
wrf_map_overlays(a,wks,(/contour/),pltres,map_res)
          draw(contour)
 ;        frame(wks)
        end if
    end do

========================
Just for plots at each vertical level *without* interpolating, the
following should work.

 do level = 0,nlevels-1
          contour                         =
wrf_contour(a,wks,*u(level,:,:)*,opts)

          plot                             =
wrf_map_overlays(a,wks,(/contour/),pltres,map_res)
          draw(contour)
         frame(wks)
    end do

==============================

On Wed, Dec 6, 2017 at 9:40 AM, Gaurav Tiwari <gaurav16 at iiserb.ac.in> wrote:

> Hi,
>
>     I tried many things suggested by you but still I am at the same level.
> Below is the output of my screen:
>
> Variable: u
> Type: float
> Total Size: 26261400 bytes
>             6565350 values
> Number of Dimensions: 3
> Dimensions and sizes: [bottom_top | 55] x [south_north | 345] x
> [west_east_stag | 346]
> Coordinates:
> Number Of Attributes: 6
>   FieldType : 104
>   MemoryOrder : XYZ
>   description : x-wind component
>   units : m s-1
>   stagger : X
>   coordinates : XLONG_U XLAT_U XTIME
>
> Variable: v
> Type: float
> Total Size: 26261400 bytes
>             6565350 values
> Number of Dimensions: 3
> Dimensions and sizes: [bottom_top | 55] x [south_north_stag | 346] x
> [west_east | 345]
> Coordinates:
> Number Of Attributes: 6
>   FieldType : 104
>   MemoryOrder : XYZ
>   description : y-wind component
>   units : m s-1
>   stagger : Y
>   coordinates : XLONG_V XLAT_V XTIME
>
> Variable: wks
> Type: obj
> Total Size: 4 bytes
>             1 values
> Number of Dimensions: 1
> Dimensions and sizes: [1]
> Coordinates:
> Number Of Attributes: 2
>   name : wind
>   app : wind appClass 7
> fatal:Number of dimensions in parameter (2) of (wrf_vector) is (3), (2)
> dimensions were expected
> fatal:["Execute.c":8640]:Execute: Error occurred at or near line 60 in
> file Zwind.ncl
>
> What I feel, the way as I fixed the pressure level is not working
> properly. Kindly see my script (and) or give me any idea how can I plot U,V
> wind at some 850 hPa obtained from WRF model output.
>
>
> --Gaurav
>
>
>
>
>
> On Wed, Dec 6, 2017 at 12:16 PM, swati shewale <shewaleswati16 at gmail.com>
> wrote:
>
>> To get rid of the error
>>
>> fatal:Number of dimensions in parameter (1) of (gsn_csm_vector) is (3),
>> (2) dimensions were expected
>>
>> I think you need to keep atleast one (pressure) level fix (from dimension
>> 'bottom_top | 55]' ) at which you want  to do plotting.
>>
>> On Tue, Dec 5, 2017 at 10:06 PM, Gaurav Tiwari <gaurav16 at iiserb.ac.in>
>> wrote:
>>
>>> Hi Rick,
>>> printVarSummary tells the given message about the variables "u" and "v"
>>>
>>>
>>> Variable: u
>>> Type: float
>>> Total Size: 26261400 bytes
>>>             6565350 values
>>> Number of Dimensions: 3
>>> Dimensions and sizes: [bottom_top | 55] x [south_north | 345] x
>>> [west_east_stag | 346]
>>> Coordinates:
>>> Number Of Attributes: 6
>>>   FieldType : 104
>>>   MemoryOrder : XYZ
>>>   description : x-wind component
>>>   units : m s-1
>>>   stagger : X
>>>   coordinates : XLONG_U XLAT_U XTIME
>>>
>>> (similarly for v)
>>>
>>> Although I tried what Dennis suggested me but still my concern is to
>>> overcome by following error
>>>
>>> fatal:Number of dimensions in parameter (1) of (gsn_csm_vector) is (3),
>>> (2) dimensions were expected
>>>
>>> Actually, wrf output variable U10, V10  have two dimensions and and U,V
>>> have three dimension, so kindly give me some idea about the above error.
>>>
>>>
>>> Thanks,
>>>
>>>
>>>
>>> On Mon, Dec 4, 2017 at 11:06 PM, Rick Brownrigg <brownrig at ucar.edu>
>>> wrote:
>>>
>>>> It is very difficult to tell what is wrong -- what does a
>>>> printVarSummary tell you about the variables "u" and "v"?
>>>>
>>>>
>>>>
>>>> On Sat, Dec 2, 2017 at 4:45 AM, Gaurav Tiwari <gaurav16 at iiserb.ac.in>
>>>> wrote:
>>>>
>>>>> Hi Dennis,
>>>>>
>>>>>      I done few changes what you suggested but still I am getting some
>>>>> error.
>>>>> Current error is attached below
>>>>>
>>>>> fatal:VectorFieldInitialize: dimensions of vfUDataArray and
>>>>> vfVDataArray are inconsistent
>>>>> fatal:Unable to initialize layer-Can't Create
>>>>> fatal:Unable to access object with id:-4
>>>>> fatal:Unable to access object with id:-4
>>>>> warning:Unable to add DataItem "(null)" to DataList "vcVectorFieldData"
>>>>> fatal:CompileDataList:DataList has no valid members
>>>>>
>>>>>
>>>>>
>>>>> Kindly let me know some ideas to plot wrf wind at different different
>>>>> pressure levels.
>>>>>
>>>>>
>>>>> -Gaurav
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ********************************************************************
>>>>> *Gaurav Tiwari*
>>>>> Research Scholar
>>>>> Department of Earth and Environmental Sciences
>>>>> Indian Institute of Science Education and Research Bhopal
>>>>> (IISER B)
>>>>> Bhopal- 462066, Madhya Pradesh
>>>>> Mob: +91-7471112407 <+91%2074711%2012407>
>>>>> LinkedIn
>>>>> <https://www.linkedin.com/in/gaurav-tiwari-bb36357a?trk=hp-identity-name>
>>>>> Research gate <https://www.researchgate.net/profile/Gaurav_Tiwari5>
>>>>>
>>>>>
>>>>> On Tue, Nov 28, 2017 at 9:13 PM, Dennis Shea <shea at ucar.edu> wrote:
>>>>>
>>>>>>
>>>>>> u10 = wrf_user_getvar(f, "U10",it)
>>>>>>  printVarSummary(u10)    ; ===> [south_north | ?] x [west_east | ?]
>>>>>>
>>>>>>
>>>>>> ---
>>>>>> u = wrf_user_getvar(f, "U",it)
>>>>>> printVarSummary(u)    ; ===>  [bottom_top | ?] x [south_north | ?] x
>>>>>> [west_east_stag | ?]
>>>>>>
>>>>>> ---
>>>>>>
>>>>>> function gsn_csm_vector (
>>>>>> 		wks  [1] : graphic,
>>>>>> 		u [*][*] : numeric,  <=== 2-dimensions
>>>>>> 		v [*][*] : numeric,  <=== 2-dimensions
>>>>>> 		res  [1] : logical
>>>>>> 	)
>>>>>>
>>>>>> kl = 5
>>>>>> vector = gsn_csm_vector(wks,u(kl,:,:),v(kl,:,:),vec_res)
>>>>>>
>>>>>> On Mon, Nov 27, 2017 at 11:09 PM, Gaurav Tiwari <
>>>>>> gaurav16 at iiserb.ac.in> wrote:
>>>>>>
>>>>>>> Dear Mary,
>>>>>>>
>>>>>>>      I am trying to plot WRF model output wind at different
>>>>>>> different atmospheric pressure levels, but I am facing an error
>>>>>>>
>>>>>>> atal:Number of dimensions in parameter (1) of (gsn_csm_vector) is
>>>>>>> (3), (2) dimensions were expected
>>>>>>> fatal:["Execute.c":8640]:Execute: Error occurred at or near line 42
>>>>>>> in file Zwind.ncl
>>>>>>>
>>>>>>>
>>>>>>> The same script is working for U10, V10 but not for U,V.
>>>>>>>
>>>>>>>
>>>>>>> --Gaurav
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> 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
>>>
>>>
>>
>
> _______________________________________________
> 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/20171206/6a28ce6e/attachment.html>


More information about the ncl-talk mailing list