[ncl-talk] Help With My GFS NCl Script

Kerwyn Texeira ktish86 at gmail.com
Tue Aug 30 19:50:18 MDT 2016


Hi ncl-talk,

I getting some errors while plotting GFS analysis data.  I  believe that
there is some confusion with the lat, lon and rest of the data.  The lat
and lon have a 1-dimensional array while the other set of data has a
2-dimensional array.  However, I am getting a plot though but I would like
to know how to correct the errors below:  I'll appreciate whatever help
that I can get.

Thanks in advance!

Error message:

(0)     check_for_y_lat_coord: Warning: Data either does not contain a
valid latitude coordinate array or doesn't contain one at all.
(0)     A valid latitude coordinate array should have a 'units' attribute
equal to one of the following values:
(0)         'degrees_north' 'degrees-north' 'degree_north' 'degrees north'
'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN' 'deg north'
(0)     check_for_lon_coord: Warning: Data either does not contain a valid
longitude coordinate array or doesn't contain one at all.
(0)     A valid longitude coordinate array should have a 'units' attribute
equal to one of the following values:
(0)         'degrees_east' 'degrees-east' 'degree_east' 'degrees east'
'degrees_E' 'Degrees_east' 'degree_E' 'degreeE' 'degreesE' 'deg east'

Variable outputs:
Variable: u_wind
Type: float
Total Size: 260640 bytes
            65160 values
Number of Dimensions: 2
Dimensions and sizes:   [lat_3 | 181] x [lon_3 | 360]
Coordinates:
            lat_3: [90..-90]
            lon_3: [ 0..359]
Number Of Attributes: 13
  lv_ISBL3 :    200
  center :      US National Weather Service - NCEP (WMC)
  long_name :   u-component of wind
  units :       m/s
  _FillValue :  1e+20
  level_indicator :     100
  grid_number : 3
  parameter_table_version :     2
  parameter_number :    33
  model :       Analysis from GFS (Global Forecast System)
  forecast_time :       0
  forecast_time_units : hours
  initial_time :        01/10/2014 (18:00)

Variable: v_wind
Type: float
Total Size: 260640 bytes
            65160 values
Number of Dimensions: 2
Dimensions and sizes:   [lat_3 | 181] x [lon_3 | 360]
Coordinates:
            lat_3: [90..-90]
            lon_3: [ 0..359]
Number Of Attributes: 13
  lv_ISBL3 :    200
  center :      US National Weather Service - NCEP (WMC)
  long_name :   v-component of wind
  units :       m/s
  _FillValue :  1e+20
  level_indicator :     100
  grid_number : 3
  parameter_table_version :     2
  parameter_number :    34
  model :       Analysis from GFS (Global Forecast System)
  forecast_time :       0
  forecast_time_units : hours
  initial_time :        01/10/2014 (18:00)

Variable: hgt
Type: float
Total Size: 260640 bytes
            65160 values
Number of Dimensions: 2
Dimensions and sizes:   [lat_3 | 181] x [lon_3 | 360]
Coordinates:
            lat_3: [90..-90]
            lon_3: [ 0..359]
Number Of Attributes: 13
  lv_ISBL3 :    200
  center :      US National Weather Service - NCEP (WMC)
  long_name :   Geopotential height
  units :       gpm
  _FillValue :  1e+20
  level_indicator :     100
  grid_number : 3
  parameter_table_version :     2
  parameter_number :    7
  model :       Analysis from GFS (Global Forecast System)
  forecast_time :       0
  forecast_time_units : hours
  initial_time :        01/10/2014 (18:00)

Variable: lat1d
Type: float
Total Size: 724 bytes
            181 values
Number of Dimensions: 1
Dimensions and sizes:   [lat_3 | 181]
Coordinates:
            lat_3: [90..-90]
Number Of Attributes: 3
  long_name :   latitude
  grid_description :    65160-point (181x360) global longitude-latitude
grid.  (0,0) at 0E, 90N, matrix layout.  N.B.: prime meridian not
duplicated.
  units :       degrees_north

Variable: lon1d
Type: float
Total Size: 1440 bytes
            360 values
Number of Dimensions: 1
Dimensions and sizes:   [lon_3 | 360]
Coordinates:
            lon_3: [ 0..359]
Number Of Attributes: 3
  long_name :   longitude
  grid_description :    65160-point (181x360) global longitude-latitude
grid.  (0,0) at 0E, 90N, matrix layout.  N.B.: prime meridian not
duplicated.
  units :       degrees_east

Variable: temp1
Type: float
Total Size: 260640 bytes
            65160 values
Number of Dimensions: 2
Dimensions and sizes:   [181] x [360]
Coordinates:
Number Of Attributes: 1
  _FillValue :  1e+20

Variable: spd
Type: float
Total Size: 260640 bytes
            65160 values
Number of Dimensions: 2
Dimensions and sizes:   [181] x [360]
Coordinates:
Number Of Attributes: 1
  _FillValue :  1e+20

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("./gfsanl_3_20140110_1800_000.grb", "r")

wks_type = "png"
wks_type at wkWidth = 2500
wks_type at wkHeight = 2500

wks= gsn_open_wks(wks_type, "speed_narr")
gsn_define_colormap(wks,"matlab_jet")

lat1d = a->lat_3
lon1d = a->lon_3
hgt = a->HGT_3_ISBL({200},:,:)
temp = a->TMP_3_ISBL({200},:,:)
u_wind = a->U_GRD_3_ISBL({200},:,:)
v_wind = a->V_GRD_3_ISBL({200},:,:)

;printVarSummary(temp)
printVarSummary(u_wind)
printVarSummary(v_wind)
printVarSummary(hgt)
printVarSummary(lat1d)
printVarSummary(lon1d)


spd = (u_wind*u_wind + v_wind*v_wind)^(0.5) ; m/s


u_wind = u_wind*1.94384449
v_wind = v_wind*1.94384449

temp1 = temp - 273
printVarSummary(temp1)
temp1!0="lat"
temp1!1="lon"

;temp1 at lat1d = lat1d
;temp1 at lon1d = lon1d

;temp1&lat at units="degrees_north"
;temp1&lon at units="degrees_east"

hgt!0="lat"
hgt!1="lon"
hgt&lat at units="degrees_north"
hgt&lon at units="degrees_east"

u_wind!0="lat"
u_wind!1="lon"
u_wind&lat at units="degrees_north"
u_wind&lon at units="degrees_east"

v_wind!0="lat"
v_wind!1="lon"
v_wind&lat at units="degrees_north"
v_wind&lon at units="degrees_east"

spd = spd*1.94384449
printVarSummary(spd)

;spd!0="lat"
;spd!1="lon"
;spd&lat at units="degrees_north"
;spd&lon at units="degrees_east"


res = True
res at gsnDraw = False
res at gsnFrame = False
res at cnLineLabelsOn =False
res at cnFillOn = True
res at mpOutlineBoundarySets = "geophysicalandusstates"
res at mpGeophysicalLineThicknessF =5.0
res at mpUSStateLineThicknessF = 5.0
res at mpNationalLineThicknessF = 5.0
res at tiMainString = "Winds (kts) at 200hpa on Jan 11 at 12:00UTC"
res at tiMainFont = "helvetica"
res at tiMainFontHeightF = 0.022
res at pmTickMarkDisplayMode = "Always"
res at mpProjection = "CylindricalEquidistant"
res at mpDataBaseVersion = "MediumRes"
res at mpOutlineOn = False
res at lbOrientation = "Vertical"
;res at tiMainOffsetYF = -0.03
res at mpFillOn  = False
res at mpOutlineOn = True
;res at tfDoNDCOverlay = True
res at mpMinLatF = 18.0
res at mpMaxLatF = 48.0
res at mpMinLonF = -160.0
res at mpMaxLonF = -114.5
res at gsnLeftString = "Geopotential Height (gpm) and Winds (kts)"
res at gsnStringFontHeightF = 0.020
res at gsnRightString = ""
res at gsnMaximize = True
res at mpShapeMode = "FreeAspect"
res at lbTitleString = "Winds (kts)"
res at lbTitleDirection = "Across"
res at lbTitleAngleF = 90
res at lbTitlePosition = "Right"
res at lbTitleFontHeightF = 0.020
res at gsnAddCyclic = False
;res at cnLevelSelectionMode = "ManualLevels"
;res at cnMinLevelValF = 10
;res at cnMaxLevelValF =130
;res at cnLevelSpacingF =10.0

res1 = True
res1 at gsnDraw = False
res1 at gsnFrame = False
res1 at cnLineColor = "Black"
res1 at gsnContourLineThicknessesScale = 7.5
res1 at gsnAddCyclic = False
;res1 at tfDoNDCOverlay = True
res1 at gsnLeftString = ""
res1 at gsnRightString = ""
res1 at cnInfoLabelOn = False
res1 at cnLineLabelBackgroundColor = "white"
res1 at cnLineLabelInterval = 1.0
res1 at cnLevelSelectionMode = "EqualSpacedLevels"


res2 = True
res2 at gsnDraw = False
res2 at gsnFrame = False
res2 at vcWindBarbLineThicknessF = 3.0
res2 at vcRefLengthF =0.018
res2 at vcRefMagnitudeF = 10
;res2 at tfDoNDCOverlay = True
res2 at vcMinDistanceF = 0.025
res2 at vcGlyphStyle = "WindBarb"
res2 at gsnRightString =""
res2 at gsnLeftString = ""
res2 at vcRefAnnoOn = False
res2 at gsnAddCyclic = False


geo = gsn_csm_contour(wks, hgt, res1)

speed = gsn_csm_contour_map(wks, spd, res)

vector = gsn_csm_vector(wks, u_wind, v_wind, res2)

overlay(speed, geo)
overlay(speed, vector)

draw(speed)
frame(wks)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160830/b48aa6ad/attachment.html 


More information about the ncl-talk mailing list