<div dir="ltr"><div class="gmail_default" style="font-size:small">I think this is related to a bug we fixed in NCL V6.4.0, which we just released yesterday.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">If you can provide me with the input files, I can try it here and see if 6.4.0 works.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Or, you can upgrade to NCL V6.4.0 and try it yourself.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><a href="http://www.ncl.ucar.edu/Download/">http://www.ncl.ucar.edu/Download/</a><br></div><div class="gmail_default"><br></div><div class="gmail_default">--Mary</div><div class="gmail_default"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 27, 2017 at 10:15 PM, Tomoko Koyama <span dir="ltr">&lt;<a href="mailto:Tomoko.Koyama@colorado.edu" target="_blank">Tomoko.Koyama@colorado.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hello,<br><br>I am trying to regrid MIROC5 Sea Ice Area Fraction (and other CMIP5 output) to EASE 100km grid. <br>The following script works for NorESM1-M sic data, but it doesn’t work for MIROC5.<br>==============================<br>…<br>…<br>…<br>(0)<span class="m_1915754056738686582Apple-tab-span" style="white-space:pre-wrap">        </span>ESMF_regrid_with_weights: retrieving interpolation weights ...<br>(0)<span class="m_1915754056738686582Apple-tab-span" style="white-space:pre-wrap">        </span>ESMF_regrid_with_weights: calling sparse_matrix_mult to apply weights...<br>(0)<span class="m_1915754056738686582Apple-tab-span" style="white-space:pre-wrap">        </span>ESMF_regrid_with_weights: putting interpolated values back onto larger 2D grid...<br>fatal:reshape_ind: the number of indexes must be the same as the rightmost dimension of x<br>fatal:[&quot;Execute.c&quot;:8567]:<wbr>Execute: Error occurred at or near line 2797 in file $NCARG_ROOT/lib/ncarg/<wbr>nclscripts/esmf/ESMF_<wbr>regridding.ncl<br><br>fatal:[&quot;Execute.c&quot;:8567]:<wbr>Execute: Error occurred at or near line 3489 in file $NCARG_ROOT/lib/ncarg/<wbr>nclscripts/esmf/ESMF_<wbr>regridding.ncl<br><br>fatal:[&quot;Execute.c&quot;:8567]:<wbr>Execute: Error occurred at or near line 92 in file MIROC5_regrid_ice.ncl<br><br>==============================<br><br>Does anyone see why this might be?<br><br>Thank you in advance,<br>Tomoko <br><br><br><br><br>;;----------------------------<wbr>------------------------------<wbr>------------<br>;; A test routine to regrid MIROC5 to EASE 100km grid<br>;;<br>;; 2017-02-27 Tomoko Koyama<br>;;----------------------------<wbr>------------------------------<wbr>------------<br>;; This code is based on &quot;ESMF_regrid_12.ncl&quot;<br>;; (<a href="http://www.ncl.ucar.edu/Applications/Scripts/ESMF_regrid_12.ncl" target="_blank">http://www.ncl.ucar.edu/<wbr>Applications/Scripts/ESMF_<wbr>regrid_12.ncl</a>)<br>;;----------------------------<wbr>------------------------------<wbr>------------<br>load &quot;$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_code.ncl&quot;<br>load &quot;$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_csm.ncl&quot;<br>load &quot;$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/contributed.<wbr>ncl&quot;<br>load &quot;$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/esmf/ESMF_<wbr>regridding.ncl&quot;<br><br>method      = &quot;bilinear&quot;<br>model       = &quot;MIROC5&quot;<br>gridtype    = &quot;latlon&quot;<br><br>doplot = 0<br><br><br>rdiri   = &quot;/Users/tomoko/CMIP5/data&quot;<br>in_diri = &quot;/Users/tomoko/CMIP5/data/<wbr>input&quot;<br>esmf_diri           = in_diri + &quot;/&quot; + model<br><br>begin<br> ; Source grid<br> srcGridDiri = rdiri + &quot;/&quot; + model<br> fili        = systemfunc(&quot;cd &quot; + srcGridDiri + &quot; ; ls sic_*.nc&quot;)<br> nfil        = dimsizes(fili)<br><br> ; Destination grid<br> dstGridDiri =&quot;/Users/tomoko/CMIP5/data/<wbr>grid_coord&quot;<br> dstFileName = &quot;NRims180x180.nc&quot;<br> dstGridFili = dstGridDiri + &quot;/&quot; + dstFileName<br> dfile       = addfile(dstGridDiri + &quot;/&quot; + dstFileName, &quot;r&quot;)<br> lat2d = dfile-&gt;latitude<br> lon2d = dfile-&gt;longitude<br><br> do ifil = 0, nfil-1<br>   srcGridFili = fili(ifil)<br>   sfile       = addfile(srcGridDiri + &quot;/&quot; + srcGridFili, &quot;r&quot;)<br>   dSizes      = getfiledimsizes(sfile)<br>   var         = sfile-&gt;sic<br><br><span class="m_1915754056738686582Apple-tab-span" style="white-space:pre-wrap">        </span>;printVarSummary( var )<br><br>   lat1d = ndtooned(lat2d)<br>   lon1d = ndtooned(lon2d)<br>   lon1d = where(lon1d.lt.0,360.0+lon1d,<wbr>lon1d)<br>   latlon_dims = dimsizes(lat2d)                 ; 180x180<br><br>   Indexes = ind(.not.ismissing(lon1d))     <br><br>   Opt                 = True<br><br>   Opt@SrcFileName     = esmf_diri + &quot;/&quot; + model +&quot;_SCRIP.nc&quot;      ; output file names<br>   Opt@DstFileName     = esmf_diri + &quot;/&quot; + &quot;EASE_ESMF.nc&quot;<br>   Opt@WgtFileName     = esmf_diri + &quot;/&quot; + model +&quot;_2_EASE_&quot;+method+&quot;.nc&quot;<br>   Opt@ForceOverwrite  = True<br><br>   Opt@SrcInputFileName    = srcGridFili          ; optional, but good idea<br>   Opt@DstInputFileName    = dstGridFili<br><br>   Opt@SkipSrcGrid     = True ;False<br>   Opt@SkipDstGrid     = True ;False<br>   Opt@SkipWgtGen      = True ;False<br>   Opt@DstESMF         = True<br><br>   Opt@DstGridType     = &quot;unstructured&quot;         ; Destination grid<br>   Opt@DstGridLat      = lat1d(Indexes)         ; Strip off missing data<br>   Opt@DstGridLon      = lon1d(Indexes)<br>   delete(lat1d)<br>   delete(lon1d)<br><br>   Opt@RemapIndexes    = True                   ; This is necessary to remap<br>   Opt@Indexes         = Indexes                ; regridded values back to <br>   Opt@IndexesDims     = latlon_dims            ; locations on destination grid<br><br>   Opt@InterpMethod    = method<br><br>   Opt@Debug           = True<br>   Opt@PrintTimings    = True<br>   Opt@NoPETLog        = True<br><br>   Opt@CopyVarCoords   = False                 ; we can&#39;t copy the coords because<br>                              <wbr>                 ; the weights on the file are only<br>                              <wbr>                 ; for the non-missing lat/lon values.<br><br><br>   Opt@SrcMask2D       = where(ismissing(var(0,:,:)),0,<wbr>1)<br><br>   var_regrid = ESMF_regrid(var,Opt)   <span class="m_1915754056738686582Apple-tab-span" style="white-space:pre-wrap">        </span>; Regrid var<br><br><br>   copy_VarAtts(var,var_<wbr>regrid)<br>   var_regrid@_FillValue = var@_FillValue<br><br>   var_regrid!0 = &quot;time&quot;<br>   var_regrid!1 = &quot;i&quot;<br>   var_regrid!2 = &quot;j&quot;<br><br>   time    = ispan(1,dSizes(0),1)<br>   time!0  = &quot;time&quot;<br>   time@long_name  = &quot;time&quot;<br>   time@units      = &quot;month&quot;<br>   time&amp;time       = time<br><br>   var_regrid&amp;time = time<br>   var_regrid&amp;i = lat2d&amp;i<br>   var_regrid&amp;j = lat2d&amp;j<br><br>   delete( var_regrid@lat1d )<br>   delete( var_regrid@lon1d )<br>   if ( isatt( var_regrid, &quot;lat2d&quot; ) ) then<br>     delete( var_regrid@lat2d )<br>   end if<br>   if ( isatt( var_regrid, &quot;lon2d&quot; ) ) then<br>     delete( var_regrid@lon2d )<br>   end if<br><br>;;----------------------------<wbr>------------------------------<wbr>------------<br>;; Write regridded data to file<br>;;----------------------------<wbr>------------------------------<wbr>------------<br>   str     = str_split(srcGridFili, &quot;.&quot;)<br>   filo    = str(0) + &quot;.<a href="http://rgrd.nc" target="_blank">rgrd.nc</a>&quot;<br><br>   if ( isfilepresent(filo) .eq. True ) then<br>     system( &quot;rm &quot; + filo )<br>   end if<br><br>   setfileoption(&quot;nc&quot;,&quot;Format&quot;<wbr>,&quot;LargeFile&quot;)<br><br>   fo = addfile( srcGridDiri + &quot;/&quot; + filo,&quot;c&quot;)<br>   fo-&gt;sic     = var_regrid<br>   ;fo-&gt;plev    = plev<br>   fo-&gt;lat     = lat2d<br>   fo-&gt;lon     = lon2d<br><br>;;----------------------------<wbr>------------------------------<wbr>------------<br>;; Plot results<br>;;----------------------------<wbr>------------------------------<wbr>------------<br><br>   if ( doplot .eq. 1 ) then<br><br>     printMinMax( var, True )<br><br>     var = where( var .le. 0.0, var@_FillValue, var )<br>     var_regrid = where( var_regrid .le. 0.0, var_regrid@_FillValue, var_regrid )<br><br>     print ( &quot;% esmf_regrid_test: Plotting results....&quot; )<br>     wks = gsn_open_wks(&quot;png&quot;,&quot;monitor/&quot; + model + &quot;_all_regrid&quot;)<br>     gsn_define_colormap(wks,&quot;<wbr>amwg&quot;)<br><br>     res                       = True<br><br>     res@gsnMaximize           = True              ; Maximize plot<br>     res@gsnDraw               = False<br>     res@gsnFrame              = False<br><br>     res@cnLevelSelectionMode  = &quot;ManualLevels&quot;<br>     res@cnMinLevelValF        =  230.<br>     res@cnMaxLevelValF        =  300.<br>     res@cnLevelSpacingF       =  10.<br><br>     res@cnFillOn              = True              ; color plot desired<br>     res@cnLinesOn             = False             ; turn off contour lines<br>     res@cnFillMode            = &quot;RasterFill&quot;<br><br>     res@lbLabelBarOn          = False<br><br>     res@gsnPolar              = &quot;NH&quot;              ; specify the hemisphere<br>     res@mpMinLatF             = 60.<br><br>     res@trGridType            = &quot;TriangularMesh&quot;  ; allow missing coordinates<br><br><br>;---Plot original data<br>     res@tiMainString = &quot;Original &quot;+model +&quot; grid (&quot; + \<br>     str_join(tostring(<wbr>dimsizes(var)),&quot; x &quot;) + &quot;)&quot;<br><br>     plot_orig1 = gsn_csm_contour_map_polar(wks,<wbr>var(2,:,:),res)   <br>     plot_orig2 = gsn_csm_contour_map_polar(wks,<wbr>var(8,:,:),res)   <br><br>;---Plot regridded data<br>     res@gsnAddCyclic = False<br>     res@sfXArray     = lon2d<br>     res@sfYArray     = lat2d<br><br>     res@tiMainString = &quot;Regridded to EASE grid (&quot; + \<br>     str_join(tostring(<wbr>dimsizes(var_regrid)),&quot; x &quot;) + &quot;)&quot;<br><br>     plot_regrid1 = gsn_csm_contour_map_polar(wks,<wbr>var_regrid(2,:,:),res)   <br>     plot_regrid2 = gsn_csm_contour_map_polar(wks,<wbr>var_regrid(8,:,:),res)   <br><br>;---Panel these two plots<br>     pres                    = True<br>     pres@gsnMaximize        = True<br>     pres@gsnPanelLabelBar   = True<br>     pres@pmLabelBarWidthF   = 0.9<br>     pres@lbLabelFontHeightF = 0.01<br><br>     gsn_panel(wks,(/plot_<wbr>orig1,plot_regrid1,plot_orig2,<wbr>plot_regrid2/),(/2,2/),pres)<br><br>     delete( res )<br>     delete( pres )<br><br>   end if<br><br>   ;; Clean up<br>   delete( var )<br>   delete( sfile )<br>   delete( dSizes )<br>   delete( Opt )<br>   delete( time )<br>   delete( filo )<br>   delete( fo )<br>   delete( var_regrid )<br><br> end do<br><br> delete( dfile )<br> delete( lat2d )<br> delete( lon2d )<br><br>end</div><br>______________________________<wbr>_________________<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" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>