Re: Edge issue in Regridding Daymet Joined Tiles with ESMF_Regridding on NCL 6.1.0

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Fri Apr 12 2013 - 18:06:32 MDT

I don't have the original script in front me, but sometimes you need to
set the special SrcMask2D array to an array of 0s and 1s, where
1 represents a "good" value, and 0 represents a bad or missing value.

I'm having to do this now in an EASE grid that has missing values
in the 2D lat/lon arrays, but I've also had to do it for arrays that
have missing values in their data arrays.

I will try this with the ESMF_all_1.ncl script to see if it makes a difference.

--Mary

On Apr 12, 2013, at 4:58 PM, Dave Allured - NOAA Affiliate wrote:

> Ping's example is fairly dramatic, but I think I have seen this
> bathtub ring effect in other cases:
>
> http://www.ncl.ucar.edu/Applications/Images/ESMF_all_1_lg.png
> http://www.ncl.ucar.edu/Applications/Images/daymet_2_lg.png
> http://www.ncl.ucar.edu/Applications/Images/daymet_3_lg.png
>
> All cases use ESMF regridding, and all cases display an unexpected
> bias toward zero along the interface between data and missing values.
> Something NOT in common is the conserve method; ESMF_all_1 uses ESMF
> bilinear.
>
> I do not have a solution, but please look for the possibility that
> input missing values are being interpreted as zeros in the core regrid
> calculation. You would get the same problem if missing values are
> accidentally being counted in the divisor, when computing the local
> area average for each output grid point. HTH.
>
> --Dave
>
> On Fri, Apr 12, 2013 at 4:12 PM, Mary Haley <haley@ucar.edu> wrote:
>> Hi Ping,
>>
>> If you have the three *.nc files that are created by ESMF_regrid, then the ESMF folks might be able to look at them to see if there's an issue with the conserve method.
>> They would also need to see exactly how ESMF_RegridWeightGen is being called, which you can see if you set:
>>
>> Opt@Debug = True
>>
>> Or, if you can provide me with your two input data files, then I can narrow down the script so that it only does one timestamp, and I will send the info off to the ESMF folks.
>>
>> http://www.ncl.ucar.edu/report_bug.shtml#HowToFTP
>>
>> --Mary
>>
>>
>> On Apr 12, 2013, at 3:19 PM, Ping Yang wrote:
>>
>>> Dear NCL,
>>>
>>> I was using the following script to regridding the joined Daymet grid (1 KM) to 3 acrmin, in which the projection was translated from LLC to lonlat and the resolution from 1 KM to 3 arcmin. However, after I tried to comparing different interpolation method based on the 3 arcmin data (I used a conserve method for the ESMF regridding), I found the this 3 arcmin data has problem in the edge/boundary.
>>>
>>> I am including a graphs here to show the problem:
>>> <image.png>
>>> The edge(coast and land) place especially in Maine (also massachusetts) looks weird after the regridding, a mixture of no data value and real values, and when I do a statistical of year sum, I got very small values(below 10 mm) for one year.
>>>
>>> The script I was using is:
>>>
>>> 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/wrf/WRFUserARW.ncl"
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl"
>>> vname ="pr"
>>> srcFileName = vname + ".NE." + year +".nc"
>>> ;srcFileName = "NE_all_1980_correct_prcp.nc"
>>> srcPathName = srcDirName+srcFileName
>>> sfile = addfile(srcPathName,"r")
>>>
>>> ;---Set the destination file name
>>> dstDirName = "/data/ecr/yangping/DAYMET/Grid/Intermediate/"
>>> system("/bin/mkdir -p "+ dstDirName)
>>> dstFileName = str_upper(vname)+"."+year+"_1KM.esmf.nc"
>>> dstPathName = dstDirName+dstFileName
>>>
>>> setfileoption("nc","Format","LargeFile")
>>>
>>> ;out=addfile("/data/ecr/yangping/DAYMET/Grid/3MIN/" + vname + "_3MIN_lonlat_" + year+".nc","c")
>>> outDirName = "/data/ecr/yangping/DAYMET/Grid/3MIN/"
>>> outFileName = vname + ".3MIN.lonlat." + year+".nc"
>>> outPathName = outDirName + outFileName
>>> system("/bin/rm -f "+outPathName) ; delete any pre-existing file
>>> out=addfile(outPathName,"c")
>>>
>>> ;--- ESMF regrid method: "conserve", "bilinear", "patch"
>>> method = "conserve"
>>> ; method = "patch"
>>>
>>> ;===================================================
>>>
>>> ;---Options
>>> Opt = True
>>> Opt@SrcTitle = "Daymet Joined Grid "+year+" to rectlinear" ; optional
>>> Opt@WgtFileName = dstDirName + "Daymet_to_Rect.Wgt.nc"
>>>
>>> Opt@ForceOverwrite = True
>>> ;;Opt@PrintTimings = True
>>>
>>> ;---Get the source file Daymet lat/lon grid
>>> lat2d = sfile->lat
>>> lon2d = sfile->lon
>>>
>>> dim2d = dimsizes(lat2d)
>>> nlat = dim2d(0)
>>> nlon = dim2d(1)
>>>
>>> print(nlat)
>>> print(nlon)
>>>
>>> ;---Get the Daymet source variable
>>> var = sfile->$vname$ ; (time, y, x)=>(365,232,221)
>>>
>>> ;Opt@SrcGridType = "curvilinear"
>>> Opt@SrcGridLat = lat2d
>>> Opt@SrcGridLon = lon2d
>>>
>>> ;---Create the destination lat/lon grid
>>> dll=0.05 ;3MIN
>>> latrange=abs(max(lat2d)-min(lat2d))
>>> lonrange=abs(max(lon2d)-min(lon2d))
>>> kpts_lat= toint(latrange/dll)+1
>>> kpts_lon= toint(lonrange/dll)+1
>>> lat = fspan( min(lat2d),max(lat2d), kpts_lat )
>>> lon = fspan( min(lon2d),max(lon2d), kpts_lon )
>>>
>>> newlon = fspan(-84.025,-64.875,384)
>>> newlat = fspan(34.875,50.125,306)
>>>
>>> Opt@DstGridType = "rectilinear"
>>> ;Opt@DstGridLat = lat
>>> Opt@DstGridLat = newlat
>>> ;Opt@DstGridLon = lon
>>> Opt@DstGridLon = newlon
>>>
>>> Opt@CopyVarCoords= True ; default for 6.1.0
>>>
>>> Opt@InterpMethod = method
>>> Opt@SrcRegional = True
>>> Opt@DstRegional = True
>>>
>>> var_regrid = ESMF_regrid(var,Opt) ; Do the regridding for 'var'
>>> printVarSummary(var_regrid)
>>> var_regrid@grid_mapping = "lonlat" ;
>>> out->$vname$=var_regrid ;output the regridding result
>>>
>>> Can some here where is the problem and how to fix it?
>>>
>>> Look forward to hearing from you.
>>>
>>> Regards,
>>>
>>> Ping
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Apr 12 18:06:41 2013

This archive was generated by hypermail 2.1.8 : Mon Apr 15 2013 - 20:12:25 MDT