[ncl-talk] ploting SLP from a regrid

SARA CORNEJO BUENO sarcorne at ucm.es
Thu Jul 26 02:48:07 MDT 2018


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180726/3d2947da/attachment.html>


More information about the ncl-talk mailing list