<div dir="ltr"><div class="gmail_default" style="font-size:small">Tomoko,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I think what's happening is that your data has coordinate arrays called i and j, which are NOT latitude / longitude values. The regridding function is trying to use these as lat / lon values, because coordinate arrays take precedence. (Maybe this is something I need to reconsider).</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Before you do the regridding, delete the i and j coordinate arrays:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">delete(var&i)</div><div class="gmail_default" style="font-size:small">delete(var&j)</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">--Mary</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 13, 2017 at 4:44 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"><div>Thank you very much, Dennis.</div><div><br></div><div>I modified the script following your suggestion and it worked except for IPSL-CM5A-LR output.</div><div><br></div><div>The error message is the same:</div><span class=""><div>“Assignment type mismatch, right hand side can't be coerced to type of left hand side” occurring at</div></span><div>var_regrid = ESMF_regrid(var,Opt)</div><div><br></div><div>Could you tell me what I miss?</div><span class=""><div><br></div><div>Tomoko</div><div><br></div><div>+++++++++++++++++</div><div>+ Error message +</div><div>+++++++++++++++++</div><div><br></div><div> Copyright (C) 1995-2015 - All Rights Reserved</div><div> University Corporation for Atmospheric Research</div><div> NCAR Command Language Version 6.3.0</div><div> The use of this software is governed by a License Agreement.</div><div> See <a href="http://www.ncl.ucar.edu/" target="_blank">http://www.ncl.ucar.edu/</a> for more details.</div><div><br></div></span><div>Variable: var</div><div>Type: float</div><div>Total Size: <a href="tel:(617)%20639-5680" value="+16176395680" target="_blank">6176395680</a> bytes</div><div> 1544098920 values</div><div>Number of Dimensions: 3</div><div>Dimensions and sizes:<span class="m_7188255107809400812Apple-tab-span" style="white-space:pre-wrap"> </span>[time | 56940] x [j | 149] x [i | 182]</div><div>Coordinates: </div><div> time: [ 0.5..56939.5]</div><div> j: [1..149]</div><div> i: [1..182]</div><div>Number Of Attributes: 13</div><span class=""><div> standard_name :<span class="m_7188255107809400812Apple-tab-span" style="white-space:pre-wrap"> </span>sea_ice_area_fraction</div><div> long_name :<span class="m_7188255107809400812Apple-tab-span" style="white-space:pre-wrap"> </span>Sea Ice Area Fraction</div></span><div> comment :<span class="m_7188255107809400812Apple-tab-span" style="white-space:pre-wrap"> </span>fraction of grid cell covered by sea ice.</div><div> units :<span class="m_7188255107809400812Apple-tab-span" style="white-space:pre-wrap"> </span>%</div><div> original_name :<span class="m_7188255107809400812Apple-tab-span" style="white-space:pre-wrap"> </span>ileadfra</div><div> original_units :<span class="m_7188255107809400812Apple-tab-span" style="white-space:pre-wrap"> </span>1</div><div> history :<span class="m_7188255107809400812Apple-tab-span" style="white-space:pre-wrap"> </span>2011-07-03T20:18:11Z altered by CMOR: Converted units from '1' to '%'. 2011-07-03T20:18:11Z altered by CMOR: replaced missing value flag (9.96921e+36) with standard missing value (1e+20).</div><div> cell_methods :<span class="m_7188255107809400812Apple-tab-span" style="white-space:pre-wrap"> </span>time: mean (interval: 30 minutes)</div><div> cell_measures :<span class="m_7188255107809400812Apple-tab-span" style="white-space:pre-wrap"> </span>area: areacello</div><div> missing_value :<span class="m_7188255107809400812Apple-tab-span" style="white-space:pre-wrap"> </span>1e+20</div><div> _FillValue :<span class="m_7188255107809400812Apple-tab-span" style="white-space:pre-wrap"> </span>1e+20</div><div> associated_files :<span class="m_7188255107809400812Apple-tab-span" style="white-space:pre-wrap"> </span>baseURL: <a href="http://cmip-pcmdi.llnl.gov/CMIP5/dataLocation" target="_blank">http://cmip-pcmdi.llnl.gov/<wbr>CMIP5/dataLocation</a> gridspecFile: gridspec_seaIce_fx_IPSL-CM5A-<wbr>LR_historical_r0i0p0.nc areacello: areacello_fx_IPSL-CM5A-LR_<wbr><a href="http://historical_r0i0p0.nc">historical_r0i0p0.nc</a></div><div> coordinates :<span class="m_7188255107809400812Apple-tab-span" style="white-space:pre-wrap"> </span>lat lon</div><div>(0)<span class="m_7188255107809400812Apple-tab-span" style="white-space:pre-wrap"> </span>get_src_grid_info: source lat dims = (149)</div><div>(0)<span class="m_7188255107809400812Apple-tab-span" style="white-space:pre-wrap"> </span>get_src_grid_info: source lon dims = (182)</div><span class=""><div>(0)<span class="m_7188255107809400812Apple-tab-span" style="white-space:pre-wrap"> </span>get_src_grid_info: source grid type is 'rectilinear'</div><div>(0)<span class="m_7188255107809400812Apple-tab-span" style="white-space:pre-wrap"> </span>curvilinear_to_SCRIP: calculating grid corners...</div><div>(0)<span class="m_7188255107809400812Apple-tab-span" style="white-space:pre-wrap"> </span>curvilinear_to_SCRIP: one or more lat values are at the</div><div>(0)<span class="m_7188255107809400812Apple-tab-span" style="white-space:pre-wrap"> </span> poles, so calculating grid corners using</div><div>(0)<span class="m_7188255107809400812Apple-tab-span" style="white-space:pre-wrap"> </span> calc_SCRIP_corners_boundaries.<wbr>..</div><div>(0)<span class="m_7188255107809400812Apple-tab-span" style="white-space:pre-wrap"> </span>calc_SCRIP_corners_boundaries</div></span><div>(0)<span class="m_7188255107809400812Apple-tab-span" style="white-space:pre-wrap"> </span> min/max original lat: 1/149</div><div>(0)<span class="m_7188255107809400812Apple-tab-span" style="white-space:pre-wrap"> </span> min/max original lon: 1/182</div><span class=""><div>fatal:Assignment type mismatch, right hand side can't be coerced to type of left hand side</div><div><br></div></span><span class=""><div>fatal:["Execute.c":8575]:<wbr>Execute: Error occurred at or near line 770 in file $NCARG_ROOT/lib/ncarg/<wbr>nclscripts/esmf/ESMF_<wbr>regridding.ncl</div><div><br></div><div><br></div></span><span class=""><div>fatal:["Execute.c":8575]:<wbr>Execute: Error occurred at or near line 1744 in file $NCARG_ROOT/lib/ncarg/<wbr>nclscripts/esmf/ESMF_<wbr>regridding.ncl</div><div><br></div><div><br></div></span><span class=""><div>fatal:["Execute.c":8575]:<wbr>Execute: Error occurred at or near line 1822 in file $NCARG_ROOT/lib/ncarg/<wbr>nclscripts/esmf/ESMF_<wbr>regridding.ncl</div><div><br></div><div><br></div></span><span class=""><div>fatal:["Execute.c":8575]:<wbr>Execute: Error occurred at or near line 3851 in file $NCARG_ROOT/lib/ncarg/<wbr>nclscripts/esmf/ESMF_<wbr>regridding.ncl</div><div><br></div><div><br></div></span><span class=""><div>fatal:["Execute.c":8575]:<wbr>Execute: Error occurred at or near line 3983 in file $NCARG_ROOT/lib/ncarg/<wbr>nclscripts/esmf/ESMF_<wbr>regridding.ncl</div><div><br></div><div><br></div></span><div>fatal:["Execute.c":8573]:<wbr>Execute: Error occurred at or near line 88</div><span class=""><div><br></div><div><br></div><div>++++++++++</div><div>+ Script +</div><div>++++++++++</div><div><br></div><div>load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_code.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_csm.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/contributed.<wbr>ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/esmf/ESMF_<wbr>regridding.ncl"</div><div><br></div><div>method = "bilinear"</div></span><div>model = "IPSL-CM5A-LR"</div><span class=""><div><br></div><div>rdiri = "/work/koyama_sice"</div><div>in_diri = "/home/koyama/CMIP5/data/<wbr>input"</div><div>esmf_diri = in_diri + "/" + model</div><div><br></div><div>begin</div><div> ; Source grid</div><div> srcGridDiri = rdiri + "/" + model</div><div> fili = systemfunc("cd " + srcGridDiri + " ; ls sic*.nc")</div><div> nfil = dimsizes(fili)</div><div><br></div><div> ; Destination grid</div><div> dstGridDiri ="/home/koyama/CMIP5/data/<wbr>grid_coord"</div><div> dstFileName = "NRims180x180.nc"</div><div> dstGridFili = dstGridDiri + "/" + dstFileName</div><div> dfile = addfile(dstGridDiri + "/" + dstFileName, "r")</div><div> lat2d = dfile->latitude</div><div> lon2d = dfile->longitude</div><div><br></div><div> do ifil = 0, nfil-1</div><div> srcGridFili = fili(ifil) </div><div> sfile = addfile(srcGridDiri + "/" + srcGridFili, "r")</div><div> dSizes = getfiledimsizes(sfile)</div><div> </div><div> var = sfile->sic</div></span><div> if (model.eq."CCSM4" .or. model.eq."NorESM1-M") then<span class="m_7188255107809400812Apple-tab-span" style="white-space:pre-wrap"> </span>; See "get_src_grid_info"</div><div> var@lat2d<span class="m_7188255107809400812Apple-tab-span" style="white-space:pre-wrap"> </span>= sfile->lat<span class="m_7188255107809400812Apple-tab-span" style="white-space:pre-wrap"> </span>; when lat dims is 2D,</div><div> var@lon2d<span class="m_7188255107809400812Apple-tab-span" style="white-space:pre-wrap"> </span>= sfile->lon<span class="m_7188255107809400812Apple-tab-span" style="white-space:pre-wrap"> </span>; this if close is necessary</div><div> end if<span class="m_7188255107809400812Apple-tab-span" style="white-space:pre-wrap"> </span>; ref. ESFM regrid - example 24</div><div><br></div><div> printVarSummary( var )</div><div><div class="h5"><div><br></div><div> lat1d = ndtooned(lat2d)</div><div> lon1d = ndtooned(lon2d)</div><div> lon1d = where(lon1d.lt.0,360.0+lon1d,<wbr>lon1d)</div><div> latlon_dims = dimsizes(lat2d) ; 180x180</div><div> </div><div> Opt = True</div><div><br></div><div> Opt@ForceOverwrite = True</div><div><br></div><div> Opt@SrcFileName = esmf_diri + "/" + model +"_SCRIP.nc" ; output file names</div><div> Opt@DstFileName = esmf_diri + "/" + "EASE_ESMF.nc"</div><div> Opt@WgtFileName = esmf_diri + "/" + model +"_2_EASE_"+method+".nc"</div><div><br></div><div> Opt@SrcInputFileName = srcGridFili ; optional, but good idea</div><div> Opt@DstInputFileName = dstGridFili</div><div><br></div><div> Opt@SkipSrcGrid = False</div><div> Opt@SkipDstGrid = False</div><div> Opt@SkipWgtGen = False</div><div> Opt@DstESMF = True</div><div><br></div><div> Indexes = ind(.not.ismissing(lon1d)) </div><div> Opt@DstGridType = "unstructured" ; Destination grid</div><div> Opt@DstGridLat = lat1d(Indexes) ; Strip off missing data</div><div> Opt@DstGridLon = lon1d(Indexes)</div><div><br></div><div> Opt@RemapIndexes = True ; This is necessary to remap</div><div> Opt@Indexes = Indexes ; regridded values back to </div><div> Opt@IndexesDims = latlon_dims ; locations on destination grid</div><div><br></div><div> Opt@InterpMethod = method</div><div><br></div><div> Opt@Debug = True</div><div> Opt@PrintTimings = True</div><div><br></div><div> Opt@CopyVarCoords = False ; we can't copy the coords because</div><div> ; the weights on the file are only</div><div> ; for the non-missing lat/lon values.</div><div><br></div><div> Opt@SrcGridMask = where(ismissing(var(0,:,:)),0,<wbr>1)</div><div><br></div><div> var_regrid = ESMF_regrid(var,Opt) ; Regrid var</div><div><br></div><div> copy_VarAtts(var,var_regrid)</div><div> var_regrid@_FillValue = 1.e+20</div><div> var_regrid@missing_value = 1.e+20</div><div> var_regrid@_FillValue = var@_FillValue</div><div><br></div><div> var_regrid!0 = "time"</div><div> var_regrid!1 = "i"</div><div> var_regrid!2 = "j"</div><div><br></div></div></div><div> if (model.eq."CCSM4") then</div><div> time = ispan(1,dSizes(3),1)</div><div> else</div><div> time = ispan(1,dSizes(0),1)</div><div> end if</div><div><div class="h5"><div> time!0 = "time"</div><div> time@long_name = "time"</div><div> time@units = "month"</div><div> time&time = time</div><div><br></div><div> var_regrid&time = time</div><div> var_regrid&i = lat2d&i</div><div> var_regrid&j = lat2d&j</div><div><br></div><div> ;delete( var_regrid@lat1d )</div><div> ;delete( var_regrid@lon1d )</div><div> if ( isatt( var_regrid, "lat2d" ) ) then</div><div> delete( var_regrid@lat2d )</div><div> end if</div><div> if ( isatt( var_regrid, "lon2d" ) ) then</div><div> delete( var_regrid@lon2d )</div><div> end if</div><div><br></div><div>;;----------------------------<wbr>------------------------------<wbr>------------</div><div>;; Write regridded data to file</div><div>;;----------------------------<wbr>------------------------------<wbr>------------</div><div> str = str_split(srcGridFili, ".")</div><div> filo = str(0) + ".<a href="http://rgrd.nc" target="_blank">rgrd.nc</a>"</div><div><br></div><div> if ( isfilepresent(srcGridDiri+"/"+<wbr>filo) .eq. True ) then</div><div> system( "rm " + filo )</div><div> end if</div><div><br></div><div> setfileoption("nc","Format","<wbr>LargeFile")</div><div> fo = addfile( srcGridDiri + "/" + filo,"c")</div></div></div><div> fo->sic = var_regrid</div><span class=""><div> fo->lat = lat2d</div><div> fo->lon = lon2d</div><div><br></div><div> ;; Clean up</div><div> delete( var )</div></span><div> delete( time )</div><span class=""><div> delete( sfile )</div><div> delete( Opt )</div><div> delete( filo )</div><div> delete( fo )</div><div> delete( var_regrid )</div><div><br></div><div> end do</div><div><br></div><div> delete( dfile )</div><div> delete( lat2d )</div><div> delete( lon2d )</div><div><br></div><div>end</div><div><br></div><div><br></div></span><div><div class="h5"><div><blockquote type="cite"><div>On Nov 13, 2017, at 8:26 AM, Dennis Shea <<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>> wrote:</div><br class="m_7188255107809400812Apple-interchange-newline"><div><div dir="ltr"><div><div>See: <br><a href="https://www.ncl.ucar.edu/Applications/ESMF.shtml" target="_blank">https://www.ncl.ucar.edu/<wbr>Applications/ESMF.shtml</a><br></div>Example 24<br><br></div>Make appropriate changes: use 'bilinear' only<br><div><div><br>Your source file has<br><b> coordinates : lat lon<br><br></b></div><div>replace<b><br></b><pre> x@lat2d = sfile->TLAT
x@lon2d = sfile->TLONG<br><br></pre><pre>with <br><br> x@lat2d = sfile->lat
x@lon2d = sfile->lon</pre>Good luck<br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Nov 12, 2017 at 2:13 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"><div>Here’s what I can get with printVarSummary(var);</div><div><br></div><div>Variable: var</div><div>Type: float</div><div>Total Size: 3588096000 bytes</div><div> 897024000 values</div><div>Number of Dimensions: 3</div><div>Dimensions and sizes: [time | 7300] x [j | 384] x [i | 320]</div><div>Coordinates:</div><div> time: [719050.5..726349.5]</div><div> j: [1..384]</div><div> i: [1..320]</div><div>Number Of Attributes: 12</div><div> standard_name : sea_ice_area_fraction</div><div> long_name : Sea Ice Area Fraction</div><div> comment : aice_d no change, CMIP5_table_comment: fraction of grid cell covered by sea ice.</div><div> units : %</div><div> original_name : aice_d</div><div> cell_methods : time: mean (interval: 30 days)</div><div> cell_measures : area: areacello</div><div> history : 2014-09-29T18:12:07Z altered by CMOR: replaced missing value flag (1e+30) with standard missing value (1e+20).</div><div> missing_value : 1e+20</div><div> _FillValue : 1e+20</div><div> associated_files : baseURL: <a href="http://cmip-pcmdi.llnl.gov/CMIP5/dataLocation" target="_blank">http://cmip-pcmdi.llnl.gov/CMI<wbr>P5/dataLocation</a> gridspecFile: gridspec_seaIce_fx_CCSM4_<a href="http://secure-web.cisco.com/1yCwSrw2YG46U8ckJsCmEFAmOAIgvR9BcggFxjdaRI5vRMFbCqGU2zNh0Xia-YOHgWeEUBwnsdMPrDBBYdSVo3nzBfkl4QIQmyK0niwjRIg3zpnluAI5PK4lIbhMVFHrj7zUA_xSp1SSDuiJTdQYhH6Fgc8TsdfnjWNQ8fpLfa-AU8Avh6nXboPIO7m_0XYJj1aV15QK_o5JAVI5LoDWvqbNiJersJuWFOxpCYQMjeLRLxcwrGmGWTB47dOYhdcJxkgNjKzL3Wqkk9XK2FnklJX0nxPXQf8Trv0HJu0hktwWUK8JKqpHROboONkDKzFv0MmFfIwzCT8_xGXglOlgrx8BeOZ7D-nwKjF10lh7Semd1XWsARasZ3xai1BIKDl-lFl1KV0tM5LHBgqYeihAze7TvWCrujoV5-bYWq5EehnMRFZ-9L3piibDzcBzeYafR/http%3A%2F%2Fhistorical_r0i0p0.nc" target="_blank">histo<wbr>rical_r0i0p0.nc</a> areacello: areacello_fx_CCSM4_historical_<a href="http://secure-web.cisco.com/14ZCWlRncW_i1YOy3Yp1Q9P7Hqe9PfKa2yT6_03GLOp4VsLue11kVzLwOsYRyxQR0g0VHuI8Zf9RaQgt5_34knBeHVIZYD_P2M8NjAp8Z_TbE8kF0vDeSE7NNN6AyNJvMgs1YXEBfaugiKrdLbqZA6gjcl4UM3NWR19H98dOvUnG0QMJIXabYQTGEMEZ4rHBGzSje0oCZ719lTBnDY7yhEb9fDLtlMSOQgnNPdFHYGpaw6JyPlo7t-u7eJ-hR7cloVlGsMka_8ZIkegX7vF_VHBL55HtiX-IA5QxV2e2gjqcg57LY6j4J5104TsrzmFwFp7R7BcZqVDrAndaF5sUKPaF6LpR3bYIAlpWGkgOhsIfKfYmrrYhwBsgdXF2jMgrAjTq3ZPti8Y_9dq8LYPdve1yOOiTPDEY_c3qj8bUnI0FqZqptTU9te9RF4NZAY48m/http%3A%2F%2Fr0i0p0.nc" target="_blank"><wbr>r0i0p0.nc</a></div><div> coordinates : lat lon</div><div><br></div><div>Thank you,</div><div>Tomoko</div><div><div class="m_7188255107809400812h5"><div><br></div><div><br></div><div><blockquote type="cite"><div>On Nov 12, 2017, at 9:02 AM, music piano <<a href="mailto:musicpianoljy@gmail.com" target="_blank">musicpianoljy@gmail.com</a>> wrote:</div><br class="m_7188255107809400812m_3545818192545176747Apple-interchange-newline"><div><div dir="ltr">Hi, Tomoko<div><br></div><div>Would you try to use printVarSummary(var) to see what type of the data is ? </div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Nov 11, 2017 at 10:50 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">Hello,<br>
<br>
I am trying to regrid Sea Ice Area Fraction and Sea Ice Thickness data from some CMIP5 daily data to EASE 100km grid.<br>
The following script works for Sea Level Pressure, Near-Surface Temperature, Geopotential Height etc. but not for those ice parameters.<br>
<br>
The error message is “Assignment type mismatch, right hand side can't be coerced to type of left hand side” occurring at regridding;<br>
var_regrid = ESMF_regrid(var,Opt)<br>
<br>
Does anyone see why this might be???<br>
<br>
Thank you in advance,<br>
Tomoko<br>
<br>
<br>
+++++++++++++++++<br>
+ Error message +<br>
+++++++++++++++++<br>
<br>
Copyright (C) 1995-2015 - All Rights Reserved<br>
University Corporation for Atmospheric Research<br>
NCAR Command Language Version 6.3.0<br>
The use of this software is governed by a License Agreement.<br>
See <a href="http://www.ncl.ucar.edu/" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/</a> for more details.<br>
(0) get_src_grid_info: source lat dims = (384)<br>
(0) get_src_grid_info: source lon dims = (320)<br>
(0) get_src_grid_info: source grid type is 'rectilinear'<br>
(0) curvilinear_to_SCRIP: calculating grid corners...<br>
(0) curvilinear_to_SCRIP: one or more lat values are at the<br>
(0) poles, so calculating grid corners using<br>
(0) calc_SCRIP_corners_boundaries.<wbr>..<br>
(0) calc_SCRIP_corners_boundaries<br>
(0) min/max original lat: 1/384<br>
(0) min/max original lon: 1/320<br>
fatal:Assignment type mismatch, right hand side can't be coerced to type of left hand side<br>
^Mfatal:["Execute.c":8575]:Exe<wbr>cute: Error occurred at or near line 770 in file $NCARG_ROOT/lib/ncarg/nclscrip<wbr>ts/esmf/ESMF_regridding.ncl<br>
<br>
^Mfatal:["Execute.c":8575]:Exe<wbr>cute: Error occurred at or near line 1744 in file $NCARG_ROOT/lib/ncarg/nclscrip<wbr>ts/esmf/ESMF_regridding.ncl<br>
<br>
^Mfatal:["Execute.c":8575]:Exe<wbr>cute: Error occurred at or near line 1822 in file $NCARG_ROOT/lib/ncarg/nclscrip<wbr>ts/esmf/ESMF_regridding.ncl<br>
<br>
^Mfatal:["Execute.c":8575]:Exe<wbr>cute: Error occurred at or near line 3851 in file $NCARG_ROOT/lib/ncarg/nclscrip<wbr>ts/esmf/ESMF_regridding.ncl<br>
<br>
^Mfatal:["Execute.c":8575]:Exe<wbr>cute: Error occurred at or near line 3983 in file $NCARG_ROOT/lib/ncarg/nclscrip<wbr>ts/esmf/ESMF_regridding.ncl<br>
<br>
^Mfatal:["Execute.c":8573]:Exe<wbr>cute: Error occurred at or near line 86<br>
<br>
++++++++++<br>
+ Script +<br>
++++++++++<br>
<br>
load "$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/csm/gsn_code.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/csm/gsn_csm.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/csm/contributed.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/esmf/ESMF_regridding.ncl"<br>
<br>
method = "bilinear"<br>
model = "CCSM4"<br>
gridtype = "latlon"<br>
<br>
rdiri = "/work/koyama_sice"<br>
in_diri = "/home/koyama/CMIP5/data/input<wbr>"<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 ="/home/koyama/CMIP5/data/grid<wbr>_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>
lat1d = ndtooned(lat2d)<br>
lon1d = ndtooned(lon2d)<br>
lon1d = where(lon1d.lt.0,360.0+lon1d,l<wbr>on1d)<br>
latlon_dims = dimsizes(lat2d) ; 180x180<br>
<br>
Opt = True<br>
<br>
Opt@ForceOverwrite = 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>
<br>
Opt@SrcInputFileName = srcGridFili ; optional, but good idea<br>
Opt@DstInputFileName = dstGridFili<br>
<br>
Opt@SkipSrcGrid = False<br>
Opt@SkipDstGrid = False<br>
Opt@SkipWgtGen = False<br>
Opt@DstESMF = True<br>
<br>
Indexes = ind(.not.ismissing(lon1d))<br>
Opt@DstGridType = "unstructured" ; Destination grid<br>
Opt@DstGridLat = lat1d(Indexes) ; Strip off missing data<br>
Opt@DstGridLon = lon1d(Indexes)<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>
<br>
Opt@CopyVarCoords = False ; we can't copy the coords because<br>
; the weights on the file are only<br>
; for the non-missing lat/lon values.<br>
<br>
Opt@SrcGridMask = where(ismissing(var(0,:,:)),0,<wbr>1)<br>
<br>
var_regrid = ESMF_regrid(var,Opt) ; Regrid var<br>
<br>
copy_VarAtts(var,var_regrid)<br>
var_regrid@_FillValue = 1.e+20<br>
var_regrid@missing_value = 1.e+20<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(3),1) ; CCSM4<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://secure-web.cisco.com/1qp3lTKKuGOiRenNSV2mBVPtaoJvr4FX79fNvr1SHNiH45LiiRgo791rBK5WvVJ328_9O9negnRBCXH87H-TT4hFZFC1Jx2Gv7S--nVCvs6J0xREDrJzfEWPXiFW0ZsKtPsAQY3KT5kCR2tSWv9ApyU_7pLbFlMoQoVPcHXKt28S2KbzbcZLHQW2uwsMY_9X1pYYswOB1CkCT8ykYCmwxrzjA3upf-XiQssRxyO-Hcq3GROvwl6HS6cRm8ADD85jf4dqfHXti59WTN27GCubmYXCahfUApc1vwD37weD2iAORkRo21fwXdt2L5agRiKwr_942CeBi4j5MClyorMHhE3J-G1fR5XRcSN3wOaf09LYw2mDSo2Lv64Q-tgRyuNz5JQkuXP8nMW1nYnEeI56nyx4oAO94r5Pl1Wt9GdAME62yUUhdRJKL9xMorz0xxBS1/http%3A%2F%2Frgrd.nc" rel="noreferrer" target="_blank">rgrd.nc</a>"<br>
<br>
if ( isfilepresent(srcGridDiri+"/"+<wbr>filo) .eq. True ) then<br>
system( "rm " + filo )<br>
end if<br>
<br>
setfileoption("nc","Format","L<wbr>argeFile")<br>
fo = addfile( srcGridDiri + "/" + filo,"c")<br>
fo->var = var_regrid<br>
fo->lat = lat2d<br>
fo->lon = lon2d<br>
<br>
;; Clean up<br>
delete( var )<br>
delete( sfile )<br>
delete( Opt )<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<br>
<br>
<br>
______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">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/mailma<wbr>n/listinfo/ncl-talk</a><br>
</blockquote></div><br></div>
</div></blockquote></div><br></div></div></div><br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">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/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
</div></blockquote></div><br></div></div></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>