Hi NCL,
I am new to the ESMF_Regridding in NCL6.1.0.
I followed the script template(Templates/ESMF_curv_to_1deg.ncl)and also
combined it with the example 8, 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"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl"
begin
;---Data file containing source grid
src_file = "~/Data/Daymet_NE_20100418_prcp.nc"
sfile = addfile(src_file,"r")
dst_file = "~/Data/Daymet_NE_20100418_Regridded_prcp.nc"
dfile = addfile(dst_file,"c")
;---Get variable to regrid
varname = "prcp"
var = sfile->$varname$
src_lat = sfile->lat ;;---Change (maybe)
src_lon = sfile->lon ;;---Change (maybe)
;---Set up regridding options
Opt = True
Opt@SrcFileName = src_file ; Name of source and
Opt@DstFileName = dst_file ; destination files
;---"bilinear" is the default. "patch" and "conserve" are other options.
Opt@InterpMethod = "bilinear"
Opt@WgtFileName = "curv_to_3minute.nc"
Opt@SrcGridLat = src_lat ; source grid
Opt@SrcGridLon = src_lon
Opt@SrcRegional = True ;;--Change (maybe)
Opt@DstRegional = True
; Opt@SrcInputFileName = src_file ; optional, but good idea
; Opt@DstGridType = "3min" ; Destination grid
; Opt@DstLLCorner = (/-84.025d,50.125d /) ;;--Change (likely)
; Opt@DstURCorner = (/-64.875d,34.875d /) ;;--Change (likely)
; Opt@DstRegional = True ;;--Change (maybe)
newlon = fspan(-84.025,-64.875,384)
newlat = fspan(34.875,50.125,306)
;---Create the destination lat/lon grid
; lat = fspan( 53.2420, 85.4022,nlat)
; lon = fspan(135.7750,258.1880,nlon)
Opt@DstGridType = "rectilinear"
Opt@DstGridLat = newlat
Opt@DstGridLon = newlon
Opt@SrcRegional = True
Opt@DstRegional = True
Opt@ForceOverwrite = True
Opt@PrintTimings = True
Opt@Debug = True
var_regrid = ESMF_regrid(var,Opt) ; Do the regridding
printVarSummary(var_regrid)
;----------------------------------------------------------------------
; Plotting section
;
; This section creates filled contour plots of both the original
; data and the regridded data, and panels them.
;----------------------------------------------------------------------
var@lat2d = src_lat ; Needed for plotting.
var@lon2d = src_lon
wks = gsn_open_wks("pdf","curv_to_3min")
xwks = gsn_open_wks("x11","curv_to_3min")
res = True
res@gsnMaximize = True
res@gsnDraw = False
res@gsnFrame = False
res@cnFillOn = True
res@cnLinesOn = False
res@cnLineLabelsOn = False
res@cnFillMode = "RasterFill"
res@lbLabelBarOn = False ; Turn on later in panel
res@mpMinLatF = min(src_lat)
res@mpMaxLatF = max(src_lat)
res@mpMinLonF = min(src_lon)
res@mpMaxLonF = max(src_lon)
;;--Change (likely)
; res@cnLevelSelectionMode = "ManualLevels"
; res@cnMinLevelValF = 0
; res@cnMaxLevelValF = 200
; res@cnLevelSpacingF = 10
;---Resources for plotting regridded data
res@gsnAddCyclic = False ;;---Change (maybe)
res@tiMainString = "3 min grid (" + Opt@InterpMethod + ")"
plot_regrid_p = gsn_csm_contour_map(wks,var_regrid,res)
plot_regrid_x = gsn_csm_contour_map(xwks,var_regrid,res)
;---Resources for plotting original data
dims = tostring(dimsizes(var))
res@gsnAddCyclic = False ;;---Change (maybe)
res@tiMainString = "Original curvilinear grid (" + \
str_join(dims," x ") + ")"
plot_orig_p = gsn_csm_contour_map(wks,var,res)
plot_orig_x = gsn_csm_contour_map(xwks,var,res)
;---Compare the plots in a panel
pres = True
pres@gsnMaximize = True
pres@gsnPanelLabelBar = True
gsn_panel(wks,(/plot_orig_p,plot_regrid_p/),(/2,1/),pres)
gsn_panel(xwks,(/plot_orig_x,plot_regrid_x/),(/2,1/),pres)
end
However, I got the following error:
(0) 'ESMF_RegridWeightGen --source source_grid_file.nc --destination
destination_grid_file.nc --weight curv_to_3minute.nc --method bilinear
--src_regional --dst_regional -i --64bit_offset'
(0) --------------------------------------------------
dyld: Library not loaded: /usr/local/lib/libgomp.1.dylib
Referenced from: /usr/local/bin/ESMF_RegridWeightGen
Reason: image not found
(0) ESMF_regrid_gen_weights: output from 'ESMF_RegridWeightGen':
(0) missing
(0) --------------------------------------------------
fatal:The result of the conditional expression yields a missing value. NCL
can not determine branch, see ismissing function
fatal:["Execute.c":7743]:Execute: Error occurred at or near line 2290 in
file $NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl
fatal:["Execute.c":7743]:Execute: Error occurred at or near line 3133 in
file $NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl
fatal:["Execute.c":7743]:Execute: Error occurred at or near line 63 in file
ESMF_Regridding.ncl
Any hint on this? I am running the NCL6.1.0 on the Mac OX 10.7.
Looking forward to hearing from.
Regards,
Ping
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Oct 29 21:45:04 2012
This archive was generated by hypermail 2.1.8 : Wed Oct 31 2012 - 09:14:12 MDT