<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Dennis</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Thanks a lot!  By reading your ncl script, I learned a lot!  Thanks for teaching me this affordable <span> rgrid2rcm. 
<span>😊</span></span></p>
<p style="margin-top:0;margin-bottom:0"><span><span> I am attaching your code below in case other people might be interested!</span></span></p>
<p style="margin-top:0;margin-bottom:0"><span><span>Thanks</span></span></p>
<p style="margin-top:0;margin-bottom:0"><span><span>Xiaoming </span></span></p>
<p style="margin-top:0;margin-bottom:0"></p>
<pre>  path_wrf   = "./"

  diro       = "./"
  filo       = "wrfchemi_d01_valueFromEdgar_rgrid2rcm_China.nc"
  ptho       = diro+filo

;---Target WRF (China)  grid

  fwrf       = addfile(path_wrf+"WRF.LatLon.nc","r")
  lat2d      = fwrf->XLAT(0,:,:)
  lon2d      = fwrf->XLONG(0,:,:)
  printVarSummary(lat2d)
  printMinMax(lat2d,0)    ;  min=12.5967   max=56.6092
  printVarSummary(lon2d)
  printMinMax(lon2d,0)    ;  min=59.5349   max=140.765

  extra      = 2          ; arbitrary
  minLat2D   = min(lat2d) - extra
  maxLat2D   = max(lat2d) + extra
  minLon2D   = min(lon2d) - extra
  maxLon2D   = max(lon2d) + extra

;===============================================
; EDGAR grid
; [lat | 1800] x [lon | 3600]   ; rectilinear
;  lat: [-89.95..89.95]
;  lon: [0.05..359.95]
;===============================================

  path_edgar = "./"
  var_name   = "emi_co2"
  fn_var     = "v42_CO2_2008_TOT.0.1x0.1.nc"       ; rectilinear 
  f_var      = addfile(path_edgar+fn_var,"r")

;===============================================
; Read *only* the EDGAR grid area surrounding China
;===============================================
  var        = f_var->$var_name$({minLat2D:maxLat2D},{minLon2D:maxLon2D})
  printVarSummary(var)  
  printMinMax(var,0)

begTime = get_cpu_time()
  var_regrid = rgrid2rcm (var&lat, var&lon, var, lat2d, lon2d, 0)
print("rgrid2rcm: " + (get_cpu_time() - begTime) + " seconds")

  var_regrid@long_name = var_name
  copy_VarCoords(lat2d, var_regrid)
  printVarSummary(var_regrid)  
  printMinMax(var_regrid,0)
  print("================")

  conv       = 1e9*3600/44  ; EDGAR in kg m-2 s-1  WRFchem need   mol km^-2 hr^-1 
  var_regrid = (/var_regrid*conv /) 
  var_regrid@units = "mol/km^2 hr^1"

  printVarSummary(var_regrid)
  printMinMax(var_regrid,0)

;=====================================
; Statistical distribution
; Use to set plot limits.
; There are outliers
;=====================================
  opt = True
  opt@PrintStat = True
  stat_var = stat_dispersion(var_regrid, opt )
;=====================================
;;       [3]          LowDec=1.35338
;;       [4]          LowOct=3.07492
;;       [5]          LowSex=7.8127
;;       [6]     LowQuartile=27.2554
;;       [7]          LowTri=51.6854
;;       [8]          Median=99.2983
;;       [9]         HighTri=331.714
;;       [10]   HighQuartile=653.725
;;       [11]        HighSex=1085.59
;;       [12]        HighOct=1480.61
;;       [13]        HighDec=1816.67
;=====================================
; PLOT
;=====================================
  wks = gsn_open_wks("png","wrf_EDGAR")

;---Set some basic plot options
  res               = True
  res@gsnMaximize   = True   ; maximize plot in frame
  res@tiMainString  = fn_var

  res@cnFillOn      = True  
  res@cnFillMode    = "RasterFill"
  res@cnFillPalette = "WhiteBlueGreenYellowRed"
  res@cnLinesOn     = False
  res@cnLineLabelsOn= False

  res@cnLevelSelectionMode = "ManualLevels"     ; set manual contour levels
  res@cnMinLevelValF       = 25.0               ; set min contour level
  res@cnMaxLevelValF       = 3000.0             ; set max contour level
  res@cnLevelSpacingF      = 25.                ; set contour spacing

  contour = gsn_csm_contour(wks,var_regrid,res)
 
  delete([/ res@cnLevelSelectionMode, res@cnMinLevelValF \
          , res@cnMaxLevelValF, res@cnLevelSpacingF      /] )

;---Change contour levels to better match the color map and/or data range being used

  res@cnLevelSelectionMode = "ExplicitLevels"
  res@cnLevels = (/ 10,20,40,60,80,100,150,200,250,300,350,400,500,600 \
                  ,700,800,900,1000,1250,1500,1750,2000,2250,2500,2750,3000/)

  res@mpProjection  = "CylindricalEquidistant"    ; The default
  res@gsnAddCyclic  = False

;---Zoom in on plot
  res@mpMinLatF     = minLat2D
  res@mpMaxLatF     = maxLat2D
  res@mpMinLonF     = minLon2D
  res@mpMaxLonF     = maxLon2D

;---Additional resources desired
  res@pmTickMarkDisplayMode = "Always"   ; nicer tickmarks

 ;res@mpDataBaseVersion     = "MediumRes"       ; better and more map outlines
 ;res@mpDataSetName         = "Earth..4"
 ;res@mpOutlineBoundarySets = "AllBoundaries"
 ;res@mpOutlineOn           = True
  res@mpFillOn              = False

  res@lbOrientation         = "Vertical"
  res@tiMainOffsetYF        = -0.03           ; Move the title down

  var_regrid@lat2d = lat2d
  var_regrid@lon2d = lon2d
  contour = gsn_csm_contour_map(wks,var_regrid,res)

</pre>
<br>
<p></p>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Dennis Shea <shea@ucar.edu><br>
<b>Sent:</b> Thursday, April 5, 2018 7:16 AM<br>
<b>To:</b> xiaoming Hu; Xiaoming Hu<br>
<b>Subject:</b> Re: ESMF_regrid with Opt@InterpMethod = "neareststod" also slow, interpolating EDGAR CO2 emission to WRF domain</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>Hi Xiaoming <br>
<br>
</div>
I just realized that you sent this regrid issue directly to me.<br>
<br>
</div>
Please, send all questions and responses to <a href="mailto:ncl-talk@ucar.edu" id="LPlnk872602" previewremoved="true">
ncl-talk@ucar.edu</a><br>
<br>
</div>
When you send questions to me, you have made your-problem ... my-problem. There are other people who watch ncl-talk who can help with regridding & ESMF questions.
<br>
<br>
===<br>
<br>
</div>
Your source 'EDGAR' grid is a global rectilinear grid of size 1800 x 3600.<br>
</div>
The WRF/China space is a small subset.<br>
<br>
</div>
The 'regrid2rcm' is a brute-force algorithm written in fortran. It will go through all 6480000 point for *each* WRF grid point.<br>
<br>
</div>
You, the user, can help yourself by extracting the WRF region only from the EDGAR grid by using NCL's coordinate subscripting.<br>
<br>
</div>
I am very busy today. I will look at the ESMF later but it is a 'standard' rectilinear to curvilinear regrid.<br>
<br>
</div>
Attached a a sample use of rgrid2rcm. Still slow, 30 sec or so on a MAC.<br>
<div>
<div><br>
</div>
<div>D<br>
</div>
</div>
</div>
<div class="x_gmail_extra"><br>
<div class="x_gmail_quote">On Wed, Apr 4, 2018 at 3:03 PM, Dennis Shea <span dir="ltr">
<<a href="mailto:shea@ucar.edu" target="_blank" id="LPlnk633828" previewremoved="true">shea@ucar.edu</a>></span> wrote:<br>
<blockquote class="x_gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div dir="ltr">His response
<div>
<div class="x_h5"><br>
<br>
<div>
<div class="x_gmail_quote">---------- Forwarded message ----------<br>
From: <b class="x_gmail_sendername">xiaoming Hu</b> <span dir="ltr"><<a href="mailto:yuanfangcan@hotmail.com" target="_blank" id="LPlnk420092" previewremoved="true">yuanfangcan@hotmail.com</a>></span><br>
Date: Wed, Apr 4, 2018 at 12:55 PM<br>
Subject: ESMF_regrid with Opt@InterpMethod = "neareststod" also slow, interpolating EDGAR CO2 emission to WRF domain<br>
To: Dennis Shea <<a href="mailto:shea@ucar.edu" target="_blank" id="LPlnk729283" previewremoved="true">shea@ucar.edu</a>>, Xiaoming Hu <<a href="mailto:xhu@ou.edu" target="_blank" id="LPlnk735677" previewremoved="true">xhu@ou.edu</a>><br>
<br>
<br>
<div dir="ltr">
<div id="x_m_2316838943992535053m_-9054703433250669627divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<div id="x_m_2316838943992535053m_-9054703433250669627divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<p style="margin-top:0; margin-bottom:0">Dear Dennis </p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">I put my files under: <a href="http://www.caps.ou.edu/micronet/CO2_and_otherGHG/WRFV3.9.1.1/YSU/wrfchem3.9.1.1_R2_China_Snudge_tracer16CTbc_SSTu_10mb_convOnScavOff.2016010100/VPRM_Preprocessor/" class="x_m_2316838943992535053m_-9054703433250669627OWAAutoLink" id="LPlnk606660" target="_blank" previewremoved="true">http://www.caps.ou.edu/<wbr>micronet/CO2_and_otherGHG/WRFV<wbr>3.9.1.1/YSU/wrfchem3.9.1.1_R2_<wbr>China_Snudge_tracer16CTbc_<wbr>SSTu_10mb_convOnScavOff.<wbr>2016010100/VPRM_Preprocessor/</a></p>
<p style="margin-top:0; margin-bottom:0">including:</p>
<p style="margin-top:0; margin-bottom:0"><a href="http://www.caps.ou.edu/micronet/CO2_and_otherGHG/WRFV3.9.1.1/YSU/wrfchem3.9.1.1_R2_China_Snudge_tracer16CTbc_SSTu_10mb_convOnScavOff.2016010100/VPRM_Preprocessor/Interp_edgar42_to_wrfchemi_ChinafromPREP_CHEM_SRC.ncl" class="x_m_2316838943992535053m_-9054703433250669627OWAAutoLink" id="LPlnk106194" target="_blank" previewremoved="true">http://www.caps.ou.edu/microne<wbr>t/CO2_and_otherGHG/WRFV3.9.1.<wbr>1/YSU/wrfchem3.9.1.1_R2_China_<wbr>Snudge_tracer16CTbc_SSTu_10mb_<wbr>convOnScavOff.2016010100/VPRM_<wbr>Preprocessor/Interp_edgar42_to<wbr>_wrfchemi_ChinafromPREP_CHEM_<wbr>SRC.ncl</a><br>
</p>
<p style="margin-top:0; margin-bottom:0"><a href="http://www.caps.ou.edu/micronet/CO2_and_otherGHG/WRFV3.9.1.1/YSU/wrfchem3.9.1.1_R2_China_Snudge_tracer16CTbc_SSTu_10mb_convOnScavOff.2016010100/VPRM_Preprocessor/WRF.LatLon.nc" class="x_m_2316838943992535053m_-9054703433250669627OWAAutoLink" id="LPlnk180068" target="_blank" previewremoved="true">http://www.caps.ou.edu/microne<wbr>t/CO2_and_otherGHG/WRFV3.9.1.<wbr>1/YSU/wrfchem3.9.1.1_R2_China_<wbr>Snudge_tracer16CTbc_SSTu_10mb_<wbr>convOnScavOff.2016010100/VPRM_<wbr>Preprocessor/WRF.LatLon.nc</a><br>
</p>
<p style="margin-top:0; margin-bottom:0"><a href="http://www.caps.ou.edu/micronet/CO2_and_otherGHG/WRFV3.9.1.1/YSU/wrfchem3.9.1.1_R2_China_Snudge_tracer16CTbc_SSTu_10mb_convOnScavOff.2016010100/VPRM_Preprocessor/v42_CO2_2008_TOT.0.1x0.1.nc" class="x_m_2316838943992535053m_-9054703433250669627OWAAutoLink" id="LPlnk31372" target="_blank" previewremoved="true">http://www.caps.ou.edu/microne<wbr>t/CO2_and_otherGHG/WRFV3.9.1.<wbr>1/YSU/wrfchem3.9.1.1_R2_China_<wbr>Snudge_tracer16CTbc_SSTu_10mb_<wbr>convOnScavOff.2016010100/VPRM_<wbr>Preprocessor/v42_CO2_2008_TOT.<wbr>0.1x0.1.nc</a><br>
</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">Please let me know if you trouble downloading the files or you need extra files.</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">The interpolated CO2 emission is like: </p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0"><a href="http://www.caps.ou.edu/micronet/CO2_and_otherGHG/WRFV3.9.1.1/YSU/wrfchem3.9.1.1_R2_China_Snudge_tracer16CTbc_SSTu_10mb_convOnScavOff.2016010100/wrfout_d01_E_CO2_0.png" class="x_m_2316838943992535053m_-9054703433250669627OWAAutoLink" id="LPlnk509463" target="_blank" previewremoved="true">http://www.caps.ou.edu/microne<wbr>t/CO2_and_otherGHG/WRFV3.9.1.<wbr>1/YSU/wrfchem3.9.1.1_R2_China_<wbr>Snudge_tracer16CTbc_SSTu_10mb_<wbr>convOnScavOff.2016010100/wrfou<wbr>t_d01_E_CO2_0.png</a></p>
<p></p>
<br>
<p></p>
<p style="margin-top:0; margin-bottom:0">Thanks a lot!</p>
<p style="margin-top:0; margin-bottom:0">Xiaoming </p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
</div>
<hr style="display:inline-block; width:98%">
<div id="x_m_2316838943992535053m_-9054703433250669627divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Dennis Shea <<a href="mailto:shea@ucar.edu" target="_blank" id="LPlnk241921" previewremoved="true">shea@ucar.edu</a>><br>
<b>Sent:</b> Wednesday, April 4, 2018 12:40:58 PM<br>
<b>To:</b> xiaoming Hu<br>
<b>Subject:</b> Re: [ncl-talk] rgrid2rcm too slow? ESMF_regrid with Opt@InterpMethod = "neareststod" also slow</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>
<div>
<div>
<div>
<div>Hello,<br>
<br>
</div>
This is offline.<br>
<br>
[1]<br>
</div>
If the 'src and 'dst' files are small (less than 1GB) could u please ftp them?<br>
<br>
</div>
If the files are large or you want to send smaller files, then use the netCDF Operators to extract the needed information.<br>
<br>
</div>
Based upon:<br>
<br>
</div>
    path_edgar = "..."<br>
<div>
<pre>  fn_co2     = "<a href="http://v42_CO2_2008_TOT.0.1x0.1.nc" id="LPlnk265168" target="_blank" previewremoved="true">v42_CO2_2008_TOT.0.1x0.1.nc</a>"<br>  f_co2      = addfile(path_edgar+fn_co2,"r")<br>  emi_co2    = f_co2->emi_co2<br> <br>  fwrf    = addfile("<a href="http://wrfinput_d01.nc" id="LPlnk795699" target="_blank" previewremoved="true">wrfinput_d01.nc</a>","r")
  lat2d      = fwrf->XLAT(0,:,:)
  lon2d      = fwrf->XLONG(0,:,:)<br><br></pre>
<div>
<pre>%> ncks -v emi_co2  path_edgar/fn_co2  <a href="http://CO2.ESMF.nc" id="LPlnk500993" target="_blank" previewremoved="true">CO2.ESMF.nc</a><br><br></pre>
<pre>%> ncks -v XLAT,XLON  <a href="http://wrfinput_d01.nc" id="LPlnk759061" target="_blank" previewremoved="true">wrfinput_d01.nc</a> <a href="http://WRF.LatLon.nc" id="LPlnk646777" target="_blank" previewremoved="true">WRF.LatLon.nc</a><br><br></pre>
<pre><span style="font-family:arial,helvetica,sans-serif">etc<br>===<br><br>ftp <a href="http://ftp.cgd.ucar.edu" id="LPlnk657838" target="_blank" previewremoved="true">ftp.cgd.ucar.edu</a><br>anonymous<br>your_email<br></span></pre>
<pre><span style="font-family:arial,helvetica,sans-serif">cd incoming<br></span></pre>
<pre><span style="font-family:arial,helvetica,sans-serif">put ...<br>put ...<br>put ...<br><br>quit<br></span></pre>
<pre><span style="font-family:arial,helvetica,sans-serif">===<br>Then send me the names of the files.<br>I'll try to look later today.<br><br>===<br></span></pre>
<pre><span style="font-family:arial,helvetica,sans-serif">That said, if you are dealing with the same grids but different variables, <br>then you can create a weight file and reuse. <br><br></span></pre>
<pre><span style="font-family:arial,helvetica,sans-serif">Even if it takes a "long time" to generate the weights, resusing the weights is essentially 'instantaneous'. Under the hood, it is a sparse matyrix multipl.<br><br><br><a href="http://www.ncl.ucar.edu/Document/Functions/ESMF/ESMF_regrid_gen_weights.shtm" id="LPlnk230580" target="_blank" previewremoved="true">http://www.ncl.ucar.edu/Docume<wbr>nt/Functions/ESMF/ESMF_regrid_<wbr>gen_weights.shtm</a><br></span></pre>
<pre>Cheers<br></pre>
<pre>D<br></pre>
<pre><br></pre>
</div>
</div>
</div>
<div class="x_m_2316838943992535053m_-9054703433250669627x_gmail_extra"><br>
<div class="x_m_2316838943992535053m_-9054703433250669627x_gmail_quote">On Wed, Apr 4, 2018 at 8:29 AM, xiaoming Hu
<span dir="ltr"><<a href="mailto:yuanfangcan@hotmail.com" id="LPlnk577208" target="_blank" previewremoved="true">yuanfangcan@hotmail.com</a>></span> wrote:<br>
<blockquote class="x_m_2316838943992535053m_-9054703433250669627x_gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div dir="ltr">
<div id="x_m_2316838943992535053m_-9054703433250669627x_m_6974270964743988311divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div id="x_m_2316838943992535053m_-9054703433250669627x_m_6974270964743988311divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<p style="margin-top:0; margin-bottom:0">I ended up using <span>Opt@InterpMethod     = "neareststod"     for <span>ESMF_regrid to make sure there is no negative values. </span></span></p>
<p style="margin-top:0; margin-bottom:0"><span><span>But <span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">ESMF_regrid  with <span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">"neareststod" 
 is also slow. </span></span></span></span></p>
<p style="margin-top:0; margin-bottom:0"><span><span><span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px"><span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">For
 comparison,   <span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">ESMF_regrid  with </span><span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">"neareststod" 
  took more than 1 hour  while <span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">ESMF_regrid  with </span></span></span></span></span></span>"patch"
 only took a few minutes</p>
<div id="x_m_2316838943992535053m_-9054703433250669627x_m_6974270964743988311divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
Any comments? </div>
<div id="x_m_2316838943992535053m_-9054703433250669627x_m_6974270964743988311divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<br>
</div>
Thanks</div>
<div id="x_m_2316838943992535053m_-9054703433250669627x_m_6974270964743988311divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
Xiaoming <br>
<br>
<div style="color:rgb(0,0,0)">
<hr style="display:inline-block; width:98%">
<div id="x_m_2316838943992535053m_-9054703433250669627x_m_6974270964743988311divRplyFwdMsg" dir="ltr">
<font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Dennis Shea <<a href="mailto:shea@ucar.edu" id="LPlnk456136" target="_blank" previewremoved="true">shea@ucar.edu</a>><br>
<b>Sent:</b> Wednesday, March 29, 2017 11:25 AM<br>
<b>To:</b> xiaoming Hu<br>
<b>Cc:</b> <a href="mailto:ncl-talk@ucar.edu" id="LPlnk519042" target="_blank" previewremoved="true">
ncl-talk@ucar.edu</a>; xiaoming Hu<br>
<b>Subject:</b> Re: [ncl-talk] rgrid2rcm too slow?</font>
<div> </div>
</div>
<div>
<div dir="ltr">Rather than:<br>
<pre>Opt@InterpMethod     = "patch"<br></pre>
<pre>Try<br><br>Opt@InterpMethod     = "bilinear"    ; or "conserve"<br><br>===<br></pre>
<pre>I think that "patch" was developed to attain highly accurate <br>derivatives.<br></pre>
<pre><br></pre>
</div>
<div class="x_m_2316838943992535053m_-9054703433250669627x_m_6974270964743988311x_gmail_extra">
<br>
<div class="x_m_2316838943992535053m_-9054703433250669627x_m_6974270964743988311x_gmail_quote">
On Wed, Mar 29, 2017 at 10:07 AM, xiaoming Hu <span dir="ltr"><<a href="mailto:yuanfangcan@hotmail.com" id="LPlnk58397" target="_blank" previewremoved="true">yuanfangcan@hotmail.com</a>></span> wrote:<br>
<blockquote class="x_m_2316838943992535053m_-9054703433250669627x_m_6974270964743988311x_gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div>
<div id="x_m_2316838943992535053m_-9054703433250669627x_m_6974270964743988311x_m_-7921913156528642728divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Arial,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<p>Dennis</p>
<p><br>
</p>
<p>Thanks a lot!  Yes, <span style="font-size:12pt">ESMF_regrid is much quicker. </span></p>
<p><span style="font-size:12pt">It mostly worked for me except negative values generated, </span></p>
<p><span style="font-size:12pt">see my original data shown at <a href="http://www.caps.ou.edu/micronet/CO2_and_otherGHG/WRFV3.8.1/YSU/wrfchem3.8.1_NARR_CONUS_nudge2_tracer16_Comet.2011080600/wrfout_d01_E_CO2_EDGAR_2.png" class="x_m_2316838943992535053m_-9054703433250669627x_m_6974270964743988311x_m_-7921913156528642728OWAAutoLink" id="LPlnk195406" target="_blank" previewremoved="true">http://www.caps.ou.edu/micr<wbr>onet/CO2_and_otherGHG/WRFV3.8.<wbr>1/YSU/wrfchem3.8.1_NARR_CONUS_<wbr>nudge2_tracer16_Comet.20110806<wbr>00/wrfout_d01_E_CO2_EDGAR_2.pn<wbr>g</a></span></p>
<p></p>
<p></p>
<p>and the interpolated data shown </p>
<p>at <a href="http://www.caps.ou.edu/micronet/CO2_and_otherGHG/WRFV3.8.1/YSU/wrfchem3.8.1_NARR_CONUS_nudge2_tracer16_Comet.2011080600/wrfout_d01_E_CO2_0.png" class="x_m_2316838943992535053m_-9054703433250669627x_m_6974270964743988311x_m_-7921913156528642728OWAAutoLink" id="LPlnk407272" target="_blank" previewremoved="true">http://www.caps.ou.edu/micr<wbr>onet/CO2_and_otherGHG/WRFV3.8.<wbr>1/YSU/wrfchem3.8.1_NARR_CONUS_<wbr>nudge2_tracer16_Comet.20110806<wbr>00/wrfout_d01_E_CO2_0.png</a></p>
<p></p>
<p></p>
<p>You may notice in the right-lower corner the contour information shows Min=-20.745</p>
<p><br>
</p>
<p>Any suggestion to improve this? </p>
<p>My interpolation script at <a href="http://www.caps.ou.edu/micronet/CO2_and_otherGHG/WRFV3.8.1/YSU/wrfchem3.8.1_NARR_CONUS_nudge2_tracer16_Comet.2011080600/Interp_edgar42_to_wrfchemi_NEI.ncl" class="x_m_2316838943992535053m_-9054703433250669627x_m_6974270964743988311x_m_-7921913156528642728OWAAutoLink" id="LPlnk198353" target="_blank" previewremoved="true">http://www.caps.ou.edu/micr<wbr>onet/CO2_and_otherGHG/WRFV3.8.<wbr>1/YSU/wrfchem3.8.1_NARR_CONUS_<wbr>nudge2_tracer16_Comet.20110806<wbr>00/Interp_edgar42_to_wrfchemi_<wbr>NEI.ncl</a></p>
<p><br>
</p>
<p>Thanks a lot!</p>
<p>Xiaoming </p>
</div>
<hr style="display:inline-block; width:98%">
<div id="x_m_2316838943992535053m_-9054703433250669627x_m_6974270964743988311x_m_-7921913156528642728divRplyFwdMsg" dir="ltr">
<font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Dennis Shea <<a href="mailto:shea@ucar.edu" id="LPlnk663222" target="_blank" previewremoved="true">shea@ucar.edu</a>><br>
<b>Sent:</b> Tuesday, March 28, 2017 11:39:23 AM<br>
<b>To:</b> xiaoming Hu<br>
<b>Cc:</b> <a href="mailto:ncl-talk@ucar.edu" id="LPlnk570068" target="_blank" previewremoved="true">
ncl-talk@ucar.edu</a><br>
<b>Subject:</b> Re: [ncl-talk] rgrid2rcm too slow?</font>
<div> </div>
</div>
<div>
<div class="x_m_2316838943992535053m_-9054703433250669627x_m_6974270964743988311x_h5">
<div>
<div dir="ltr">
<div>
<div>
<div>
<div>rgrid2rcm can be slow.<br>
<br>
</div>
Use ESMF: there are exam<br>
<a href="http://www.ncl.ucar.edu/Applications/ESMF.shtml" id="LPlnk506042" target="_blank" previewremoved="true">http://www.ncl.ucar.edu/Applic<wbr>ations/ESMF.shtml</a><br>
<br>
</div>
There are numerous examples of  going  from rectilinear ('rgrid') to curvilinear ('rcm')<br>
</div>
Examples 9, 15, 28-30, 32, 33,<br>
<br>
</div>
HTH<br>
<div>
<div> <br>
</div>
</div>
</div>
<div class="x_m_2316838943992535053m_-9054703433250669627x_m_6974270964743988311x_gmail_extra">
<br>
<div class="x_m_2316838943992535053m_-9054703433250669627x_m_6974270964743988311x_gmail_quote">
On Tue, Mar 28, 2017 at 9:30 AM, xiaoming Hu <span dir="ltr"><<a href="mailto:yuanfangcan@hotmail.com" id="LPlnk285794" target="_blank" previewremoved="true">yuanfangcan@hotmail.com</a>></span> wrote:<br>
<blockquote class="x_m_2316838943992535053m_-9054703433250669627x_m_6974270964743988311x_gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div dir="ltr">
<div id="x_m_2316838943992535053m_-9054703433250669627x_m_6974270964743988311x_m_-7921913156528642728m_758473393344624224divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Arial,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<p>I am doing <br>
</p>
<p>"</p>
<div>dummy1     = rgrid2rcm (elat, elon, emi_co2, lat2d, lon2d, 0)<br>
</div>
"
<p></p>
<p>where lat2d and lon2d have a dimension of 442x265</p>
<p><br>
</p>
<p>The script appears to take forever. <br>
</p>
<p><br>
</p>
<p>Any other ways to do a faster interpolation? <br>
</p>
<p><br>
</p>
<p>Thanks a lot!</p>
<span class="x_m_2316838943992535053m_-9054703433250669627x_m_6974270964743988311x_m_-7921913156528642728HOEnZb"><font color="#888888">
<p>Xiaoming <br>
</p>
</font></span></div>
</div>
<br>
______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" id="LPlnk789304" target="_blank" previewremoved="true">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" id="LPlnk47810" target="_blank" previewremoved="true">http://mailman.ucar.edu/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
<br>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</body>
</html>