[ncl-talk] Problems Plotting NARR data
Dennis Shea
shea at ucar.edu
Mon Aug 1 15:04:56 MDT 2016
The is a 'generic' comment.
http://www.ncl.ucar.edu/Applications/
Under 'Datasets' Click 'NARR'
These do not include overlays but if you are dealing with NARR, you should
be aware of this link
On Mon, Aug 1, 2016 at 3:00 PM, Mary Haley <haley at ucar.edu> wrote:
> Hi Kerwyn,
>
> In the future, it would help if you could provide the output of doing:
>
> printVarSummary(temp)
> printVarSummary(hgt)
> etc.
>
> so we know what your variables look like.
>
> 1. If "temp" is a 3D array with pressure level as its leftmost dimension,
> and if the "level" dimension of "temp" is represented by a level coordinate
> array that's already in hPA units, then you should be able to use
> coordinate subscripting to get the level you want:
>
> temp = a->TMP_221_ISBL({600},:,:) ; The use of { and } specifies that
> you want to subset based on coordinate values, rather than index values
> u_wind = a->U_GRD_221_ISBL({600},:,:)
>
> 2. To zoom in on the map, you don't want to tell NCL that you are using
> the native projection. This means you do NOT want to set tfDoNDCOverlay to
> True. Just remove this or comment it out, because it is False by default.
>
> For a better understanding of plotting data in a native projection and a
> non-native projection, see example dataonmap_native_4.ncl at:
>
> http://www.ncl.ucar.edu/Applications/plot_data_on_map.shtml#ex4native
>
> 3. I think the fatal error is occurring because you were trying to plot a
> 3D array. Once you do #1 and subscript temp, u, and v as described, then
> you should end up with 2D arrays that you can create contour and vector
> plots from.
>
> If you continue to have problems, please post back to ncl-talk. It would
> also help if we could have your data and the latest version of your script.
>
> Thanks,
>
> --Mary
>
>
>
>
>
> On Sat, Jul 30, 2016 at 10:13 PM, Kerwyn Texeira <ktish86 at gmail.com>
> wrote:
>
>> Hi ncl-talk,
>>
>> I'm trying to plot and overlay of (NARR) North American Regional
>> Reanalysis temperature, geopotential height contours, and wind barbs at
>> 600mb but I'm running into some problems.
>>
>> 1. Where on the script should I mention the pressure level eg 600hpa so
>> that both the temperature, wind barbs and geopotential heights can be
>> plotted at this level that level?
>>
>> 2. How do I zoom into an area? I specified the min lat, lon and max lat,
>> lon but it seems not to zoom into the area of interest?
>>
>> 3. I do not understand why I'm getting the following error:
>>
>> (0) gsn_csm_contour_map_ce: Fatal: the input data array must be 1D
>> or 2D
>> fatal:Illegal right-hand side type for assignment
>> fatal:["Execute.c":8578]:Execute: Error occurred at or near line 113 in
>> file narr_temp.ncl
>>
>> 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
>> temp = a->TMP_221_ISBL
>> pres = a->PRES_221_HYBL
>> u_wind = a->U_GRD_221_ISBL
>> v_wind = a->V_GRD_221_ISBL
>> lev = a->lv_ISBL3 ; 29 levels
>>
>> 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
>>
>> temp = temp - 273
>>
>> temp at lat2d = lat2d
>> temp 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 700hpa 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 mpOutlineOn = "True"
>> res at lbOrientation = "Vertical"
>> res at tiMainOffsetYF = -0.03
>> res at mpFillOn = False
>> 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.020
>> 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.05
>> res1 at vcGLyphStyle = "WindBarb"
>> res1 at gsnRightString =""
>> 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)
>>
>> temp = gsn_csm_contour_map(wks, temp, res)
>>
>> vector = gsn_csm_vector(wks, u_wind, v_wind, res1)
>>
>> overlay(temp, geo)
>> overlay(temp, vector)
>>
>> draw(temp)
>> frame(wks)
>>
>> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>>
>> end
>>
>> Whatever help anyone can give to me will be greatly appreciated. I 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
>>
>>
>
> _______________________________________________
> 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/8a0df7f6/attachment.html
More information about the ncl-talk
mailing list