[ncl-talk] Problem plotting data after using linint2

Ligia Bernardet - NOAA Affiliate ligia.bernardet at noaa.gov
Tue Jan 3 10:49:29 MST 2017


Hello,

I am trying to regrid a Hurricane WRF fost-processed forecast and then plot
it, but I am getting the following error:

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

The original array is has 721 lat points (90 to -90, with 0.25 deg
increments) and 1440 longitude points (0 to 275.75, with 0.25 increments).
I am able to plot and print it correctly.

After linint2, I am able to print the interpolated field and it looks OK.
But I cannot plot it.

Seems like attributes are missing?

Thanks for your help,
Ligia
ps: NCL script is below

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"

; Read forecast file
f1 =
addfile("/mnt/lfs2/projects/dtc-hurr/Ligia.Bernardet/Sat_verif/Ligia_sat_prep/
gonzalo08l.2014101412.hwrfsat.global.0p25.f024.nc","r")
vNames = getfilevarnames (f1)

; There is only one variable in the file, param7.5.0. GOES13 has 4
channels, then F17 SMIS had 7 channels, then SEVIRI has 7 channels, total
18 fields,
; NCL interprets as multiple times
; Read GOES_13 Channel 4, lat and lon
; Lat2d has 721 values, from 90 to -90, with 0.25 deg intervals
; Lon2d has 1440 values, from 0 to 359.75, with 0.25 deg intervals
vname = "param7.5.0"
f1_goes4  =  f1->$vname$(2,:,:)
lat2d = f1->lat
lon2d = f1->lon

; Navigate forecast data so it is associated with 2D lat-lon arrays
f1_goes4 at lon2d=conform_dims((/721,1440/),lon2d,1)
f1_goes4 at lat2d=conform_dims((/721,1440/),lat2d,0)

; Replace NaN with -999
f1_goes4=where(isnan_ieee(f1_goes4) .eq. True, -999., f1_goes4)

; *****************************************************8
; Find corners of forecast data - in this case it is a global dataset
f1_min_lat=min(lat2d)
f1_max_lat=max(lat2d)
f1_min_lon=min(lon2d)
f1_max_lon=max(lon2d)

; **************************************************************
; Create lat/lon arrays for output grid. Assign attributes
merge_lat=fspan(f1_min_lat+90,f1_max_lat, 45)
merge_lon=fspan(f1_min_lon+260,f1_min_lon+290,30)

merge_lat at units = "degrees_north"
merge_lat at standard_name = "latitude"
merge_lat at long_name = "latitude"
merge_lon at units = "degrees_east"
merge_lon at standard_name = "longitude"
merge_lon at long_name = "longitude"

;***************************************************************
; regrid forecast
 print ("Start regridding of forecast")

skip=1
regrid_f1=linint2(lon2d(::skip),lat2d(::-skip),f1_goes4(::-skip,::skip),False,merge_lon,merge_lat,0)

regrid_f1 at merge_lat=merge_lat
regrid_f1 at merge_lon=merge_lon


; *****************************************************8
;---Plot forecast regridded data
  wks = gsn_open_wks("png","sat_hwrf_regridded")
  res              = True
  res at gsnMaximize  = True     ; maximize plot in frame
  res at cnFillOn     = True     ; turn on contour fill
  res at cnLinesOn    = False    ; turn off contour fill
  res at tiMainString = "forecast"

  plot = gsn_csm_contour_map(wks,regrid_f1,res)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170103/7493dcda/attachment.html 


More information about the ncl-talk mailing list