<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"><<a href="mailto:Tomoko.Koyama@colorado.edu" target="_blank">Tomoko.Koyama@colorado.edu</a>></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:["Execute.c":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:["Execute.c":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:["Execute.c":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 "ESMF_regrid_12.ncl"<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 "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_code.ncl"<br>load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_csm.ncl"<br>load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/contributed.<wbr>ncl"<br>load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/esmf/ESMF_<wbr>regridding.ncl"<br><br>method = "bilinear"<br>model = "MIROC5"<br>gridtype = "latlon"<br><br>doplot = 0<br><br><br>rdiri = "/Users/tomoko/CMIP5/data"<br>in_diri = "/Users/tomoko/CMIP5/data/<wbr>input"<br>esmf_diri = in_diri + "/" + model<br><br>begin<br> ; Source grid<br> srcGridDiri = rdiri + "/" + model<br> fili = systemfunc("cd " + srcGridDiri + " ; ls sic_*.nc")<br> nfil = dimsizes(fili)<br><br> ; Destination grid<br> dstGridDiri ="/Users/tomoko/CMIP5/data/<wbr>grid_coord"<br> dstFileName = "NRims180x180.nc"<br> dstGridFili = dstGridDiri + "/" + dstFileName<br> dfile = addfile(dstGridDiri + "/" + dstFileName, "r")<br> lat2d = dfile->latitude<br> lon2d = dfile->longitude<br><br> do ifil = 0, nfil-1<br> srcGridFili = fili(ifil)<br> sfile = addfile(srcGridDiri + "/" + srcGridFili, "r")<br> dSizes = getfiledimsizes(sfile)<br> var = sfile->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 + "/" + model +"_SCRIP.nc" ; output file names<br> Opt@DstFileName = esmf_diri + "/" + "EASE_ESMF.nc"<br> Opt@WgtFileName = esmf_diri + "/" + model +"_2_EASE_"+method+".nc"<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 = "unstructured" ; 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'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 = "time"<br> var_regrid!1 = "i"<br> var_regrid!2 = "j"<br><br> time = ispan(1,dSizes(0),1)<br> time!0 = "time"<br> time@long_name = "time"<br> time@units = "month"<br> time&time = time<br><br> var_regrid&time = time<br> var_regrid&i = lat2d&i<br> var_regrid&j = lat2d&j<br><br> delete( var_regrid@lat1d )<br> delete( var_regrid@lon1d )<br> if ( isatt( var_regrid, "lat2d" ) ) then<br> delete( var_regrid@lat2d )<br> end if<br> if ( isatt( var_regrid, "lon2d" ) ) 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, ".")<br> filo = str(0) + ".<a href="http://rgrd.nc" target="_blank">rgrd.nc</a>"<br><br> if ( isfilepresent(filo) .eq. True ) then<br> system( "rm " + filo )<br> end if<br><br> setfileoption("nc","Format"<wbr>,"LargeFile")<br><br> fo = addfile( srcGridDiri + "/" + filo,"c")<br> fo->sic = var_regrid<br> ;fo->plev = plev<br> fo->lat = lat2d<br> fo->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 ( "% esmf_regrid_test: Plotting results...." )<br> wks = gsn_open_wks("png","monitor/" + model + "_all_regrid")<br> gsn_define_colormap(wks,"<wbr>amwg")<br><br> res = True<br><br> res@gsnMaximize = True ; Maximize plot<br> res@gsnDraw = False<br> res@gsnFrame = False<br><br> res@cnLevelSelectionMode = "ManualLevels"<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 = "RasterFill"<br><br> res@lbLabelBarOn = False<br><br> res@gsnPolar = "NH" ; specify the hemisphere<br> res@mpMinLatF = 60.<br><br> res@trGridType = "TriangularMesh" ; allow missing coordinates<br><br><br>;---Plot original data<br> res@tiMainString = "Original "+model +" grid (" + \<br> str_join(tostring(<wbr>dimsizes(var))," x ") + ")"<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 = "Regridded to EASE grid (" + \<br> str_join(tostring(<wbr>dimsizes(var_regrid))," x ") + ")"<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>