<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]:<wbr>Execute: Error occurred at or near line 770 in file $NCARG_ROOT/lib/ncarg/<wbr>nclscripts/esmf/ESMF_<wbr>regridding.ncl<br>
<br>
^Mfatal:["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<br>
<br>
^Mfatal:["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<br>
<br>
^Mfatal:["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<br>
<br>
^Mfatal:["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<br>
<br>
^Mfatal:["Execute.c":8573]:<wbr>Execute: Error occurred at or near line 86<br>
<br>
++++++++++<br>
+ Script +<br>
++++++++++<br>
<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 = "CCSM4"<br>
gridtype = "latlon"<br>
<br>
rdiri = "/work/koyama_sice"<br>
in_diri = "/home/koyama/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 ="/home/koyama/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>
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>
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://rgrd.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","<wbr>LargeFile")<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">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>
</blockquote></div><br></div>