[ncl-talk] wrf_map_overlays zoom fail
Mary Haley
haley at ucar.edu
Fri Dec 21 08:51:53 MST 2018
Borja,
I think what is happening is that when you use wrf_user_ll_to_ij to select
the region of interest for plotting, you are only getting an approximation
of that region, because this function looks for the closest lat/lon
coordinate associated with your data. In order to do an exact match, it
would have to interpolate, which is not what this function was meant for.
If you want to see the zoomed data in the exact area that you've specified,
then please look at our "WRF plotting - zooming in on maps" examples page,
and in particular, look at example wrf_zoom_3.ncl:
http://www.ncl.ucar.edu/Applications/wrfzoom.shtml#ex3
This requires that you not use the gsn_csm_xxxx_map plotting functions, but
I think you might find that you have more flexibility with the plots if you
use these functions.
--Mary
On Fri, Dec 21, 2018 at 1:40 AM Borja Sas González <saszalez at gmail.com>
wrote:
> Dear Mary.
>
> Thanks for your answer.
>
> You're right, I have an error in the units. Still, that does not solve the
> error when ncl draw the map with zoom.
>
> I explain it, and I attach images.
>
> The first plott is of the complete domain. That plott is correct and
> corresponds to the "Full domain" image.
>
> In the second plott I try to zoom. I indicate in the script the following:
>
> ;--- Establecimiento de variables
>
>
> time = 12
>
>
> minlat = 28.10
>
> maxlat = 28.30
>
> minlon = -16.40
>
> maxlon = -16.15
>
>
> loc = wrf_user_ll_to_ij(a,(/minlon,maxlon/),(/minlat,maxlat/),True)
>
>
> x_start = loc(0,0) - 1
>
> x_end = loc(0,1) - 1
>
> y_start = loc(1,0) - 1
>
> y_end = loc(1,1) - 1
>
>
> ;--- Creación de los gráficos para el dominio zoom
>
>
> mpres at ZoomIn = True ; set up map info for zoomed area
>
> mpres at Xstart = x_start
>
> mpres at Ystart = y_start
>
> mpres at Xend = x_end
>
> mpres at Yend = y_end
>
>
> plot = wrf_map_overlays(a,wks,(/vectorz/),pltres,mpres)
>
>
> As you can see in the zoom image, the latitude and longitude do not
> correspond with what I have indicated (minlat, maxlat, minlon, maxlon).
>
> Best regards.
>
> El jue., 20 dic. 2018 a las 23:45, Mary Haley (<haley at ucar.edu>) escribió:
>
>> Dear Borja,
>>
>> Can you be more specific on what you mean by "it does not draw the
>> latitude and longitude indicated in the script."? It helps if you can
>> provide an image and then indicate exactly what is wrong with the image.
>>
>> One thing that is not correct with your code is that u10 and v10 are
>> getting multiplied twice by 1.94386. You first have it here:
>>
>> ;--- Establecimiento de las variables de viento
>>
>> u10 = wrf_user_getvar(a,"U10",time)
>>
>> v10 = wrf_user_getvar(a,"V10",time)
>>
>> u10 = u10*1.94386
>>
>> v10 = v10*1.94386
>>
>> u10 at units = "kts"
>>
>> v10 at units = "kts"
>>
>> and then it is done again here:
>>
>> ;--- Establecimiento de las variables de viento para zoom
>>
>> u10z = u10(y_start:y_end,x_start:x_end) ; u a 10 m con zoom
>>
>> v10z = v10(y_start:y_end,x_start:x_end) ; v a 10 m con zoom
>>
>> * u10 = u10*1.94386 <--------- u10 and v10 have already
>> been multiplied by 1.94386 *
>>
>> * v10 = v10*1.94386 *
>>
>> u10 at units = "kts" <--------- u10 and v10 already have
>> the units applied
>>
>> v10 at units = "kts"
>>
>>
>> Note that u10z and v10z should already have the 1.94386 scale factor
>> applied, but their units are not correct. You set the u10 and v10 units to
>> "kts" twice.
>>
>> I'm not sure if this is going to affect the lat/lon issue, but if you
>> still have the lat/lon issue after fixing the above, then provide an image
>> if you can. It would help to include the non-zoomed image as well.
>>
>> Thanks,
>>
>> --Mary
>>
>>
>> On Wed, Dec 19, 2018 at 3:28 PM Borja Sas González <saszalez at gmail.com>
>> wrote:
>>
>>> Dear NCL users.
>>>
>>> I have created a simple script, in which the wind vectors are drawn at
>>> 10 m. Also, I try to zoom the domain, but it does not draw the latitude and
>>> longitude indicated in the script. The latitude and longitude that is drawn
>>> is random.
>>>
>>> Can someone help me find the error?
>>>
>>> Thank you very much to all.
>>>
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>>>
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
>>>
>>>
>>> begin
>>>
>>> ;--- Open WRF output file
>>>
>>> a = addfile("wrfout_d03_2018-12-19_00:00:00.nc","r")
>>>
>>>
>>> ;--- Start the graphics
>>>
>>> wks = gsn_open_wks("x11","Puertito")
>>>
>>>
>>> ;--- Set some basic plot options
>>>
>>> res = True
>>>
>>> res at MainTitle = "Kitersurf Wind"
>>>
>>>
>>> ;--- Establecimiento de variables
>>>
>>>
>>> time = 12
>>>
>>>
>>> minlat = 28.10
>>>
>>> maxlat = 28.30
>>>
>>> minlon = -16.40
>>>
>>> maxlon = -16.15
>>>
>>>
>>> loc = wrf_user_ll_to_ij(a,(/minlon,maxlon/),(/minlat,maxlat/),True)
>>>
>>>
>>> x_start = loc(0,0) - 1
>>>
>>> x_end = loc(0,1) - 1
>>>
>>> y_start = loc(1,0) - 1
>>>
>>> y_end = loc(1,1) - 1
>>>
>>>
>>> ;--- Establecimiento de las variables de viento
>>>
>>> u10 = wrf_user_getvar(a,"U10",time)
>>>
>>> v10 = wrf_user_getvar(a,"V10",time)
>>>
>>> u10 = u10*1.94386
>>>
>>> v10 = v10*1.94386
>>>
>>> u10 at units = "kts"
>>>
>>> v10 at units = "kts"
>>>
>>>
>>> ;--- Establecimiento de las variables de viento para zoom
>>>
>>> u10z = u10(y_start:y_end,x_start:x_end) ; u a 10 m con zoom
>>>
>>> v10z = v10(y_start:y_end,x_start:x_end) ; v a 10 m con zoom
>>>
>>> u10 = u10*1.94386 ; vector uz en knots
>>>
>>> v10 = v10*1.94386 ; vector vz en knots
>>>
>>> u10 at units = "kts" ; unidad del vector uz
>>>
>>> v10 at units = "kts" ; unidad del vector vz
>>>
>>>
>>> ;--- Opciones de plotting de los vectores de viento
>>>
>>>
>>> opts = res
>>>
>>> opts at FieldTitle = "Viento"
>>>
>>> opts at NumVectors = 47
>>>
>>> vector = wrf_vector(a,wks,u10,v10,opts)
>>>
>>> vectorz = wrf_vector(a,wks,u10z,v10z,opts)
>>>
>>> delete(opts)
>>>
>>>
>>> pltres = True
>>>
>>>
>>> mpres = True
>>>
>>>
>>> ;--- Variables del mapa de terreno
>>>
>>> mpres at mpGeophysicalLineColor = "Black"
>>>
>>> mpres at mpNationalLineColor = "Black"
>>>
>>> mpres at mpGridAndLimbOn = False
>>>
>>> mpres at mpDataBaseVersion = "HighRes"
>>>
>>> mpres at mpDataSetName = "Earth..4"
>>>
>>> mpres at mpGeophysicalLineThicknessF = 5
>>>
>>> mpres at mpNationalLineThicknessF = 3
>>>
>>> mpres at mpShapeMode = "FreeAspect"
>>>
>>> mpres at vpKeepAspect = True
>>>
>>> ;mpres at vpWidthF = 0.9
>>>
>>> ;mpres at vpHeightF = 0.6
>>>
>>>
>>> ;--- Creación de los gráficos para el dominio completo
>>>
>>> plot = wrf_map_overlays(a,wks,(/vector/),pltres,mpres)
>>>
>>>
>>> ;--- Creación de los gráficos para el dominio zoom
>>>
>>> mpres at ZoomIn = True
>>>
>>> mpres at Xstart = x_start
>>>
>>> mpres at Ystart = y_start
>>>
>>> mpres at Xend = x_end
>>>
>>> mpres at Yend = y_end
>>>
>>>
>>> plot = wrf_map_overlays(a,wks,(/vectorz/),pltres,mpres)
>>>
>>>
>>> end
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>
>
> --
> Borja Sas González
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20181221/50e10290/attachment.html>
More information about the ncl-talk
mailing list