[ncl-talk] ploting SLP from a regrid

Mary Haley haley at ucar.edu
Fri Jul 27 16:35:47 MDT 2018


Dear Sara,

The problem is that you are trying to use wrf_xxxx functions on non-WRF
data. The wrf_xxxx functions are tailored to work specifically with WRF-ARW
output data, which is usually named something like "wrfout_d01_xxxxxxx".

I don't know what your data looks like, so I can't tell you how to
correctly plot it.  However, if you visit this page:

http://www.ncl.ucar.edu/Applications/plot_data_on_map.shtml

then my guess is that you'll be able to use dataonmap_1.ncl if your data is
rectilinear, or dataonmap_3.ncl if your data is curvilinear. The definition
of rectilinear and curvilinear are provided on that page.

Don't worry about the fact that the data was read off a GRIB file for the
dataonmap_3.ncl example. The script will be useful for any curvilinear data.

If you don't understand the examples or have problems with them, please
post back to ncl-talk.

Good luck,

--Mary





On Thu, Jul 26, 2018 at 2:48 AM, SARA CORNEJO BUENO <sarcorne at ucm.es> wrote:

> Hello,
>
> I'm trying to make a sea level pressure plot from a Regrid; this is part
> of the code
>
> ;;;;;; Set basic resources ;;;;;;
>   res           = True
>   res at MainTitle = "Sea Level Pressure_811"
>   time                       = wrf_user_getvar(a,"time",-1) ; get all time
> in the file
>   ntime = dimsizes(time)
>   do it = 0,ntime-1,1           ; TIME LOOP
>   res at TimeLabel               = time(it)                  ; Set Valid
> time to use on plots
> ;exit()
>   ; Open workstation
>   wks_type          = "png"
>   wks_type at wkWidth  = 2000
>   wks_type at wkHeight = 2000
>   wks               = gsn_open_wks(wks_type, "/Volumes/SimuPlots/slp_811_"
> +time(it)+ "")
>
>   gsn_define_colormap(wks,"BlAqGrYeOrRe")
> ;exit()
>
> ;;;;;; Set plot and map resources ;;;;;;
>   pltres = True
>   mpres = True
>   mpres at mpOutlineBoundarySets       = "National"
>   mpres at mpDataBaseVersion           = "MediumRes"
>   mpres at mpDataSetName               = "Earth..4"
>   mpres at mpGeophysicalLineColor      = "Black"
>   mpres at mpGeophysicalLineThicknessF = 4.0
> ;exit()
> LON =a->longitude
> ;print(lon)
> LAT=a->latitude
> ;print(lat)
> LON = LON-360  ;así son longitudes W
> ;print(LON)
> LAT = LAT(::-1)     ; overwrite: reverse using NCL syntax (para recolocar
> la latitud (tiene que estar S-N))
> ;exit()
>   if (isvar("zoomCoords")) then
>    ; lat2d = wrf_user_Agetvar(a,"latitude",0)
>     ;lon2d = wrf_user_getvar(a,"longitude",0)
> ;exit()
>     ; Coordenadas de la zona del mapa que quiero dibujar
>     mpres at mpLimitMode = "Corners"
>     mpres at mpLeftCornerLatF = zoomCoords(0)
>     mpres at mpLeftCornerLonF = zoomCoords(1)
>     mpres at mpRightCornerLatF = zoomCoords(2)
>     mpres at mpRightCornerLonF = zoomCoords(3)
>   end if
> ;exit()
>   ; Get the variables
>
>   slp = wrf_user_getvar(a,"SLP",it)
>   slp at units ="hPa"
>
>
> All goes right untill the following part:
>
> the problem appears at the end, on this part of the code:
>
> ;;;;;; Plotting options for slp ;;;;;
>     opts2 = res
>     opts2 at cnLevelSelectionMode = "ExplicitLevels"
>     opts2 at gsnContourLineThicknessesScale = 7.0
>     opts2 at cnLineColor = "Blue"
>     opts2 at cnLineLabelInterval        = 1             ; default = 2
>     opts2 at cnLineLabelPlacementMode = "constant"
>     opts2 at cnLineLabelDensityF = 2   ;densidad de info-boxes en una linea
> de contorno
> ;    opts2 at cnLevels = (/ 980, 984, 988, 990, 994, 998, 1000, 1002, 1004,
> 1008, 1010, 1012, 1018, 1020, 1022 /)
>     opts2 at ContourParameters = (/ 980, 1022, 2 /)
>     opts2 at cnFillOn = False
>     contour_slp = wrf_contour(a, wks, slp, opts2)
>     delete(opts2)
>
> It appears these warnings:
>
> warning:Attempt to reference attribute (TITLE) which is undefined
>
> warning:Attempt to reference attribute (DX) which is undefined
>
> warning:Attempt to reference attribute (WEST-EAST_GRID_DIMENSION) which is
> undefined
>
> warning:Attempt to reference attribute (SOUTH-NORTH_GRID_DIMENSION) which
> is undefined
>
> warning:Attempt to reference attribute (BOTTOM-TOP_GRID_DIMENSION) which
> is undefined
>
>
> The code continues like this
>
>     ; MAKE PLOTS
>     if (isvar("zoomCoords")) then
>       pltres at LatLonOverlay = True
>     end if
>     plot = wrf_map_overlays(a, wks, (/contour_slp/), pltres, mpres)
>
>   end do ; TIME LOOP
> ;end do ; DAY LOOP
> end
> And then the error says:
>
> (0) wrf_map: Error: no MAP_PROJ attribute in input file
>
> fatal:overlay: missing value as input, can't continue
>
> fatal:["Execute.c":8640]:Execute: Error occurred at or near line 83 in
> file Plot_SLP_simus.ncl,
>
>
> line 83 corresponds to:
>
>
>  plot = wrf_map_overlays(a, wks, (/contour_slp/), pltres, mpres)
>
>
> What I could understand is that, now, I don't have LAT and LONG
> coordinates, but grid points. But I don't know how to call them.
>
> Thank you very much in advance.
>
>
> _______________________________________________
> 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/20180727/fb988ae3/attachment.html>


More information about the ncl-talk mailing list