[3606979] Will I be getting a plot like this using ESMF_rect_to_curv.ncl script

From: Robert Oehmke <robert.oehmke_at_nyahnyahspammersnyahnyah>
Date: Wed Mar 06 2013 - 16:06:13 MST

Hi Mary and Palash,

 From the picture it looks like the destination grid is coarser than the input grid. This would explain the blockiness of the destination grid output. It may also explain why the white areas are creeping inwards some. Masking (as Mary suggests) may help with this. This may also come from coarser elements overlapping both blue and white and numerically interpolating to a value of blue, where you would want white to dominate. If the masking doesn't give you the result you want, let me know and we can look into it further.

Thanks,

- Bob

On Mar 5, 2013, at 3:21 PM, Mary Haley wrote:

> Palash,
>
> I've included ESMF support on this message. I'm not familiar enough with the conserve method to know if this is an expected result.
>
> It's possible you need to set a "mask" for the source grid. Try adding:
>
> opt@SrcMask2D = where(.not.ismissing(var),1,0)
>
> -Mary
>
> Begin forwarded message:
>
>> From: mmkamal@uwaterloo.ca
>> Subject: Will I be getting a plot like this using ESMF_rect_to_curv.ncl script
>> Date: February 25, 2013 6:15:07 PM MST
>> To: ncl-talk@ucar.edu
>>
>> Hi All,
>>
>> I have generated the following plot using http://www.ncl.ucar.edu/Applications/Templates/ESMF_rect_to_curv.ncl script but a bit confused about the simulation pattern. Could you please tell me whether I should be expecting a figure of this type or not? I look forward to hearing from you. Please see the attached figure:
>>
>>
>> Thanks
>> Palash
>>
>>
>> Here you go the code I have used:
>>
>> ===========================================
>>
>> ;---------------------------------------------------------------------
>> 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 = "prcp_jan_day_cu_sum.nc" ;;---Change (likely)
>> sfile = addfile(src_file,"r")
>>
>> src_lat = sfile->lat ;;---Change (likely)
>> src_lon = sfile->lon ;;---Change (likely)
>>
>> ;---Get variable to regrid
>> varname = "prcp" ;;---Change (likely)
>> var = sfile->$varname$ ; Assumption is that "var"
>> ; contains coordinate arrays.
>> printVarSummary(var) ; Make sure it has coord arrays.
>>
>> ;---Data file containing destination grid
>> dst_file = "wrfout_d02_2002-01-01.nc" ;;---Change (likely)
>> dfile = addfile(dst_file,"r")
>> dst_lat = dfile->XLAT(0,:,:) ;;---Change (likely)
>> dst_lon = dfile->XLONG(0,:,:) ;;---Change (likely)
>>
>> ;---Set up regridding options
>> Opt = True
>>
>> ;---"bilinear" is the default. "patch" and "conserve" are other options.
>>
>> method = "conserve"
>> Opt@InterpMethod = method ;;---Change (maybe)
>>
>> Opt@WgtFileName = "rect_to_curv.nc"
>>
>> ;
>> ; These next two lines only needed if "var" doesn't
>> ; contain coordinate arrays.
>> ;
>> Opt@SrcGridLat = sfile->lat ;;--Change (maybe)
>> Opt@SrcGridLon = sfile->lon ;;--Change (maybe)
>>
>> Opt@SrcRegional = True ;;--Change (maybe)
>> Opt@SrcInputFileName = src_file ; optional, but good idea
>>
>> Opt@DstGridLat = dst_lat ; destination grid
>> Opt@DstGridLon = dst_lon
>> Opt@DstRegional = True ;;--Change (maybe)
>>
>> Opt@CopyVarCoords = True ; Needed in V6.1.0-beta (not in V6.1.0)
>>
>> Opt@ForceOverwrite = True
>> Opt@PrintTimings = True
>> Opt@Debug = True
>>
>> var_regrid = ESMF_regrid(var,Opt) ; Do the regridding
>>
>> printVarSummary(var_regrid) ; Check that everything
>> printMinMax(var_regrid,0) ; looks okay.
>>
>> ;---Info needed if 'netCDF' and/or 'PLOT' is True
>> dimv = dimsizes(var)
>> ntim = dimv(0)
>> nlat = dimv(1)
>> mlon = dimv(2)
>>
>> dimvr = dimsizes(var_regrid)
>> NLAT = dimvr(1)
>> MLON = dimvr(2)
>>
>> delete(var_regrid@grid_mapping) ; not for regridded variable
>>
>> ;----------------------------------------------------------------------
>> ; Plotting section
>> ;
>> ; This section creates filled contour plots of both the original
>> ; data and the regridded data, and panels them.
>> ;----------------------------------------------------------------------
>> wks = gsn_open_wks("png","day_cu_sum_rect_to_curv")
>> gsn_define_colormap(wks,"BlAqGrYeOrReVi200")
>>
>>
>> res = True
>>
>> res@gsnMaximize = True
>> res@gsnLeftString = "Jan Total Precipitation"
>> res@gsnAddCyclic = False
>>
>> ; res@gsnDraw = False
>> ; res@gsnFrame = False
>>
>> res@cnFillOn = True
>> res@cnLinesOn = False
>> res@cnLineLabelsOn = False
>> ; res@cnFillMode = "RasterFill"
>>
>> res@lbLabelBarOn = True ; Turn on later in panel
>> res@lbOrientation = "Vertical" ; default is horizontal
>>
>> res@mpFillOn = True
>>
>>
>> res@mpMinLatF = min(dst_lat)
>> res@mpMaxLatF = max(dst_lat)
>> res@mpMinLonF = min(dst_lon)
>> res@mpMaxLonF = max(dst_lon)
>>
>> res@mpGridLineDashPattern = 2 ; lat/lon lines as dashed
>>
>> ;************************************************
>> ; Turn on lat / lon labeling
>> ;************************************************
>> res@pmTickMarkDisplayMode = "Always" ; turn on tickmarks
>> res@tmXTOn = False ; turn off top labels
>> res@tmYROn = False ; turn off right labels
>>
>> res@mpFillOn = True ; turn off map fill
>>
>> res@mpOutlineBoundarySets= "GeophysicalAndUSStates" ; state boundaries
>> res@mpDataBaseVersion = "MediumRes"
>>
>> res@cnLevelSelectionMode = "ManualLevels"
>> res@cnMinLevelValF = 10.0
>> res@cnMaxLevelValF = 150.0
>> res@cnLevelSpacingF = 10.0
>> ;*************************************************************************************
>>
>> ;---Resources for plotting regridded data
>> res@gsnAddCyclic = False ;;---Change (maybe)
>> res@tiMainString = "Curvilinear grid (" + Opt@InterpMethod + ")"
>> var_regrid@units = "mm"
>>
>> plot_regrid = gsn_csm_contour_map(wks,var_regrid(30,:,:),res)
>>
>> ; plot = gsn_csm_contour_map(wks,var_regrid(30,:,:),res)
>>
>> ;---Resources for plotting original data
>> var@lat2d = src_lat
>> var@lon2d = src_lon
>> var@units = "mm"
>>
>> res@gsnAddCyclic = False ;;---Change (maybe)
>> res@tiMainString = "Original rectilinear grid"
>>
>> plot_orig = gsn_csm_contour_map(wks,var(30,:,:),res)
>>
>> ;---Compare the plots in a panel
>> pres = True
>> pres@gsnMaximize = True
>> pres@gsnPanelLabelBar = True
>>
>> gsn_panel(wks,(/plot_orig,plot_regrid/),(/1,2/),pres)
>>
>> end
>>
>>
>>
>>
>>
>>
>>
>>
>> <day_cu_sum_rect_to_curv.000003.png><DAY_minus_WRF_Prcp.000004.png>_______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> _______________________________________________
> esmf_support mailing list
> esmf_support@list.woc.noaa.gov
> https://list.woc.noaa.gov/cgi-bin/mailman/listinfo/esmf_support
Received on Wed Mar 6 16:06:22 2013

This archive was generated by hypermail 2.1.8 : Thu Mar 07 2013 - 08:55:58 MST