[ncl-talk] Still Problems Plotting NAAR data
Mary Haley
haley at ucar.edu
Mon Aug 1 21:05:38 MDT 2016
Kerwyn,
If you set both the lat2d/lon2d special attributes *and* you set
tfDoNDCOverlay to True, then you are giving conflicting information to the
gsn_csm_xxx_map scripts.
When you set res at tfDoNDCOverlay to True, you are telling NCL that your data
is already projected into some map projection, and NCL assumes that you
have set all the necessary resources for this map projection. You should
NOT set lat2d/lon2d when tfDoNDCOverlay is set to True.
To fix your script, try commenting out all "tfDoNDCOverlay" settings.
On Mon, Aug 1, 2016 at 6:24 PM, Kerwyn Texeira <ktish86 at gmail.com> wrote:
> Hi ncl-talk,
>
> I made all the changes but I'm still unable to plot a zoomed in an
> overlay of both winds, temperature, and geopotential height.
>
> I'm not getting any errors though but it just will not plot or plot
> right. I have attached to figure.
>
> Whatever help you can offer me will be greatly appreciated.
>
> Thanks!!!
>
> Some outputs:
>
> Variable: temp
> Type: float
> Total Size: 386692 bytes
> 96673 values
> Number of Dimensions: 2
> Dimensions and sizes: [gridx_221 | 277] x [gridy_221 | 349]
> Coordinates:
> Number Of Attributes: 15
> lv_ISBL3 : 600
> sub_center : The North American Regional Reanalysis (NARR) Project
> center : US National Weather Service - NCEP (WMC)
> long_name : Temperature
> units : K
> _FillValue : 1e+20
> coordinates : gridlat_221 gridlon_221
> level_indicator : 100
> grid_number : 221
> parameter_table_version : 131
> parameter_number : 11
> model : North American Regional Reanalysis (NARR)
> forecast_time : 0
> forecast_time_units : hours
> initial_time : 01/28/2014 (00:00)
>
> Variable: u_wind
> Type: float
> Total Size: 386692 bytes
> 96673 values
> Number of Dimensions: 2
> Dimensions and sizes: [gridx_221 | 277] x [gridy_221 | 349]
> Coordinates:
> Number Of Attributes: 15
> lv_ISBL3 : 600
> sub_center : The North American Regional Reanalysis (NARR) Project
> center : US National Weather Service - NCEP (WMC)
> long_name : u-component of wind
> units : m/s
> _FillValue : 1e+20
> coordinates : gridlat_221 gridlon_221
> level_indicator : 100
> grid_number : 221
> parameter_table_version : 131
> parameter_number : 33
> model : North American Regional Reanalysis (NARR)
> forecast_time : 0
> forecast_time_units : hours
> initial_time : 01/28/2014 (00:00)
>
> Variable: v_wind
> Type: float
> Total Size: 386692 bytes
> 96673 values
> Number of Dimensions: 2
> Dimensions and sizes: [gridx_221 | 277] x [gridy_221 | 349]
> Coordinates:
> Number Of Attributes: 15
> lv_ISBL3 : 600
> sub_center : The North American Regional Reanalysis (NARR) Project
> center : US National Weather Service - NCEP (WMC)
> long_name : v-component of wind
> units : m/s
> _FillValue : 1e+20
> coordinates : gridlat_221 gridlon_221
> level_indicator : 100
> grid_number : 221
> parameter_table_version : 131
> parameter_number : 34
> model : North American Regional Reanalysis (NARR)
> forecast_time : 0
> forecast_time_units : hours
> initial_time : 01/28/2014 (00:00)
>
> Variable: hgt
> Type: float
> Total Size: 386692 bytes
> 96673 values
> Number of Dimensions: 2
> Dimensions and sizes: [gridx_221 | 277] x [gridy_221 | 349]
> Coordinates:
> Number Of Attributes: 15
> lv_ISBL3 : 600
> sub_center : The North American Regional Reanalysis (NARR) Project
> center : US National Weather Service - NCEP (WMC)
> long_name : Geopotential height
> units : gpm
> _FillValue : 1e+20
> coordinates : gridlat_221 gridlon_221
> level_indicator : 100
> grid_number : 221
> parameter_table_version : 131
> parameter_number : 7
> model : North American Regional Reanalysis (NARR)
> forecast_time : 0
> forecast_time_units : hours
> initial_time : 01/28/2014 (00:00)
>
> My script:
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>
> begin
> a = addfile("./narr-a_221_20140128_0000_000.grb", "r")
>
> wks_type = "png"
> wks_type at wkWidth = 2500
> wks_type at wkHeight = 2500
>
> wks= gsn_open_wks(wks_type, "temp_narr")
> gsn_define_colormap(wks,"matlab_jet")
>
> lat2d = a->gridlat_221
> lon2d = a->gridlon_221
> hgt = a->HGT_221_ISBL({600},:,:)
> temp = a->TMP_221_ISBL({600},:,:)
> pres = a->PRES_221_HYBL
> u_wind = a->U_GRD_221_ISBL({600},:,:)
> v_wind = a->V_GRD_221_ISBL({600},:,:)
> lev = a->lv_ISBL3 ; 29 levels
>
> ;printVarSummary(temp)
> ;printVarSummary(u_wind)
> ;printVarSummary(v_wind)
> ;printVarSummary(hgt)
>
> spd = (u_wind*u_wind + v_wind*v_wind)^(0.5) ; m/s
>
> pres = pres*0.01 ; converts to hpa
>
> u_wind = u_wind*1.94384449
> v_wind = v_wind*1.94384449
>
> temp1 = temp - 273
>
> temp1 at lat2d = lat2d
> temp1 at lon2d = lon2d
>
> hgt at lat2d = lat2d
> hgt at lon2d = lon2d
>
> pres at lon2d = lon2d
> pres at lat2d = lat2d
>
> u_wind at lon2d = lon2d
> u_wind at lat2d = lat2d
>
> spd = spd*1.94384449
>
> spd at lon2d = lon2d
> spd at lat2d = lat2d
>
> v_wind at lat2d = lat2d
> v_wind at lon2d = lon2d
>
>
> res = True
> res at gsnDraw = False
> res at gsnFrame = False
> res at cnLineLabelsOn = False
> res at cnFillOn = True
> res at tiMainString = "Temperature (C) at 600hpa on Jan 28 at 00:00UTC"
> res at tiMainFont = "helvetica"
> res at tiMainFontHeightF = 0.02
> res at pmTickMarkDisplayMode = "Always"
> res at mpProjection = "CylindricalEquidistant"
> res at mpDataBaseVersion = "MediumRes"
> res at mpOutlineOn = "True"
> res at lbOrientation = "Vertical"
> res at tiMainOffsetYF = -0.03
> res at mpFillOn = False
> res at mpOutlineOn = True
> ;res at tfDoNDCOverlay = True
> res at mpMinLatF = 37.85
> res at mpMaxLatF = 38.50
> res at mpMinLonF = -120.0
> res at mpMaxLonF = -119.0
> res at gsnLeftString = "Geopotential Height (m) and Winds (kts)"
> res at gsnStringFontHeightF = 0.020
> res at gsnRightString = ""
> res at gsnMaximize = True
> res at mpShapeMode = "FreeAspect"
> res at lbTitleString = "Temperature (C)"
> res at lbTitlePosition = "Right"
> res at lbTitleFontHeightF = 0.015
> res at gsnAddCyclic = False
> ;res at cnLevelSelectionMode = "ManualLevels"
> ;res at cnMinLevelValF =
> ;res at cnMaxLevelValF =
> ;res at cnLevelSpacingF =
>
> res1 = True
> res1 at gsnDraw = False
> res1 at gsnFrame = False
> res1 at vcWindBarbLineThicknessF = 7.0
> res1 at vcRefLengthF =0.018
> res1 at vcRefMagnitudeF = 10
> ;res1 at vcMinDistanceF = 0.017
> res1 at vcGlyphStyle = "WindBarb"
> res1 at gsnRightString =""
> res1 at gsnLeftString = ""
> res1 at vcRefAnnoOn = False
> res1 at gsnAddCyclic = False
>
> res2 = True
> res2 at gsnDraw = False
> res2 at gsnFrame = False
> res2 at cnLineColor = "Black"
> res2 at gsnContourLineThicknessesScale = 5.0
> res2 at gsnAddCyclic = False
> ;res2 at tfDoNDCOverlay = True
> res2 at gsnLeftString = ""
> res2 at gsnRightString = ""
> res2 at cnInfoLabelOn = False
> ;res2 at cnLevelSpacingF = 2
> res2 at cnLineLabelBackgroundColor = "white"
> res2 at cnLineLabelDensityF = 1
>
> geo = gsn_csm_contour(wks, hgt, res2)
>
> t600 = gsn_csm_contour_map(wks, temp1, res)
>
> vector = gsn_csm_vector(wks, u_wind, v_wind, res1)
>
> overlay(t600, geo)
> overlay(t600, vector)
>
> draw(t600)
> frame(wks)
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> end
>
>
>
> _______________________________________________
> 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/20160801/9dd5906b/attachment-0001.html
More information about the ncl-talk
mailing list