<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:宋体;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@宋体";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.gmail-p1, li.gmail-p1, div.gmail-p1
        {mso-style-name:gmail-p1;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
span.gmail-s1
        {mso-style-name:gmail-s1;}
span.gmail-s2
        {mso-style-name:gmail-s2;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>Hi, Mary:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>Thanks for your suggestion. After plotting the coordinates of the model grids, I found that all the regridded missing points are out of the model domain. So plotting the model domain by box lines as I did before is not an accurate way to represent the model domain. <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>--------------------------------------<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>Lijun Diao<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>University of Houston<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><b><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'>From:</span></b><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'> Mary Haley [mailto:haley@ucar.edu] <br><b>Sent:</b> Wednesday, March 29, 2017 12:31 PM<br><b>To:</b> Lijun Diao &lt;ljdiao@gmail.com&gt;<br><b>Cc:</b> ncl-talk@ucar.edu<br><b>Subject:</b> Re: [ncl-talk] esmf_regrid fails to regrid at some locations<o:p></o:p></span></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><div><div><p class=MsoNormal>Lijun,<o:p></o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal>It's hard to tell what the problem is without looking at both the source and destination grids. I don't know what your original data looks like, or where the grid points fall. It would be easier if you could provide me with the two NetCDF files so I can run the script here.<o:p></o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal>What I usually do is plot both the original data and the regridded data on separate plots, and then add the source grid and the destination grid as a series of points so I can see more clearly where they overlap. Depending on whether the data itself has missing values, this could also affect how it is regridded.<o:p></o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal>You can use gsn_coordinates to plot markers at locations where your original or regridded data is missing and/or non missing. This way you don't need to do all the &quot;ind&quot; calls yourself. See the fourth thumbnail image of example #7 here:<o:p></o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal><a href="http://www.ncl.ucar.edu/Applications/plot_data_on_map.shtml#ex7">http://www.ncl.ucar.edu/Applications/plot_data_on_map.shtml#ex7</a><o:p></o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal>To use gsn_coordinates, replace this code:<o:p></o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=gmail-p1><span class=gmail-s1><span style='font-family:"Courier New"'>&nbsp;&nbsp;</span></span><span class=gmail-s2><span style='font-family:"Courier New"'>; add polymarkers at missing value locations &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span></span><o:p></o:p></p></div><div><div><p class=MsoNormal><span style='font-family:"Courier New"'>&nbsp; co_regrid2D = CO_regrid(10,0,:,:)</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-family:"Courier New"'>&nbsp; indices &nbsp; &nbsp; = ind_resolve(ind(ismissing(ndtooned(co_regrid2D))), dimsizes(co_regrid2D))</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-family:"Courier New"'>&nbsp; dims &nbsp; &nbsp; &nbsp; &nbsp;= dimsizes(indices)</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-family:"Courier New"'>&nbsp; npts &nbsp; &nbsp; &nbsp; &nbsp;= dims(0)</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-family:"Courier New"'>&nbsp; Lon_group &nbsp; = new(npts,float)</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-family:"Courier New"'>&nbsp; Lat_group &nbsp; = new(npts,float)</span><o:p></o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal><span style='font-family:"Courier New"'>&nbsp; do n = 0,npts-1</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-family:"Courier New"'>&nbsp; &nbsp; Lon_group(n) = lon2d_AIRS(indices(n,0),indices(n,1))</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-family:"Courier New"'>&nbsp; &nbsp; Lat_group(n) = lat2d_AIRS(indices(n,0),indices(n,1))</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-family:"Courier New"'>&nbsp; end do</span><o:p></o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal><span style='font-family:"Courier New"'>&nbsp; pmres &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = True</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-family:"Courier New"'>&nbsp; pmres@gsMarkerColor &nbsp; &nbsp; &nbsp; = &quot;black&quot;</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-family:"Courier New"'>&nbsp; pmres@gsMarkerIndex &nbsp; &nbsp; &nbsp; = 16</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-family:"Courier New"'>&nbsp; pmres@gsMarkerSizeF &nbsp; &nbsp; &nbsp; = 0.02</span><o:p></o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal><span style='font-family:"Courier New"'>&nbsp; gsn_polymarker(wks, plot, Lon_group, Lat_group, pmres)</span><o:p></o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal>with this code&nbsp;(UNTESTED):<o:p></o:p></p></div><div><p class=gmail-p1><span class=gmail-s1><span style='font-family:"Courier New"'>&nbsp;&nbsp;</span></span><span class=gmail-s2><span style='font-family:"Courier New"'>; add polymarkers at missing value locations &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span></span><o:p></o:p></p></div><div><div><p class=MsoNormal><span style='font-family:"Courier New"'>&nbsp; mkres = True</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-family:"Courier New"'>&nbsp; mkres@gsMarkerIndex &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= 16 &nbsp; &nbsp; ; filled dots</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-family:"Courier New"'>&nbsp; mkres@gsMarkerSizeF &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= 3 &nbsp; &nbsp; &nbsp;; you may need to adjust this</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-family:"Courier New"'>&nbsp; mkres@gsnCoordsNonMissingColor = &quot;black&quot;</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-family:"Courier New"'>&nbsp; mkres@gsnCoordsMissingColor &nbsp; &nbsp;= &quot;red&quot;</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-family:"Courier New"'>&nbsp; gsn_coordinates(wks,plot,co_regrid(10,0,:,:),mkres)</span><o:p></o:p></p></div></div></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal>Meanwhile, let me know if you can provide the data files. You can use our ftp site:<o:p></o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal><a href="http://www.ncl.ucar.edu/report_bug.shtml#HowToFTP">http://www.ncl.ucar.edu/report_bug.shtml#HowToFTP</a><o:p></o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal>Thanks,<o:p></o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal>--Mary<o:p></o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p><div><p class=MsoNormal>On Mon, Mar 27, 2017 at 9:36 AM, Lijun Diao &lt;<a href="mailto:ljdiao@gmail.com" target="_blank">ljdiao@gmail.com</a>&gt; wrote:<o:p></o:p></p><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in'><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Hi, NCL talk forum:<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>I am using ESMF_regrid to regrid my modeled CO (dimentioned Lev(15)*Row(299)*Col(459)) to AIRS L2 swath locations (dimentioned 45*30). I attached my code test.ncl for the &nbsp;regridding and plotting. I found some of the regridded output are missing values. Then I plotted those missing value locations (black dots in the attached figure). The red dashed box defines my model domain. I understand when the satellite swath is &nbsp;out of the model domain, the regridded CO will be missing values since no model grids will correspond to those locations. But as you can see, some black dots are actually inside my model domain, especially the upper right ones, which are relatively far away from the edges of the model domain. In another words, the esmf regrid program can not regrid accurately for some of the swath locations that are inside the model domain. It doesn’t make sense to me. What is the reason?<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Thanks,<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>--------------------------------------<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Lijun Diao<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>University of Houston<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;<o:p></o:p></p></div></div><p class=MsoNormal style='margin-bottom:12.0pt'><br>_______________________________________________<br>ncl-talk mailing list<br><a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>List instructions, subscriber options, unsubscribe:<br><a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><o:p></o:p></p></blockquote></div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div></div></body></html>