<div dir="ltr"><div dir="ltr"><div dir="ltr"><div>The 'golden rule' of data processing is "Look at your data"</div><div><br></div><div>The variable is dimensioned as follows:<br></div><div><br></div><div><i> float precipitation(<span style="color:rgb(0,0,255)"><b>nlon, nlat)</b></span> ;</i></div><div><i><br></i></div><div>The ESMF software is expecting:<i> <i>(<span style="color:rgb(0,0,255)"><b>nlat, nlon)</b></span></i></i></div><div><i><i><span style="color:rgb(0,0,255)"><b><br></b></span></i></i></div><div><b><span style="color:rgb(0,0,0)"> prc_trmm = f->precipitation</span></b></div><div><b><span style="color:rgb(0,0,0)"> prc_trmm := prc_trmm(nlat|:,nlon|:)</span></b><i><i><span style="color:rgb(0,0,255)"><b> </b></span></i></i><span style="color:rgb(0,0,255)"><b>; reorder</b></span><i><i><span style="color:rgb(0,0,255)"><b> </b></span></i></i><b><span style="color:rgb(0,0,255)">t</span></b><span style="color:rgb(0,0,255)"><b>o that expected</b></span><i><i><span style="color:rgb(0,0,255)"><b> </b></span></i></i><span style="color:rgb(0,0,255)"><b>by ESMF</b></span><i><i><span style="color:rgb(0,0,255)"><b>; overwrite</b></span></i></i></div><div><i><i><span style="color:rgb(0,0,255)"><b><br></b></span> </i></i></div><div><i><br></i></div><div>Try and see what happens.</div><div>===</div><div><br></div><div>Comment: the TRMM grid spans approximately 50S to 50N and is global in longitude.</div><div>I have not looked but I speculate the WRF grid spans a *MUCH* smaller spatial extent.</div><div><br></div><div>I suggest using NCL's coordinate subscripting to extract a subset of the TRMM grid.</div><div><br></div><div> fn_wrf = "<a href="http://geo_em.d04.nc" target="_blank">geo_em.d04.nc</a>"<br> fwrf = addfile(path_wrf+fn_wrf,"r")<br> lat2d = fwrf->XLAT_M(0,:,:) ; WRF<br> lon2d = fwrf->XLONG_M(0,:,:)<br><br>;---Create an 'extra' large boundary around the WRF grid<br> extra = 2 ; arbitrary<br> minLat2D = min(lat2d) - extra<br> maxLat2D = max(lat2d) + extra<br> minLon2D = min(lon2d) - extra<br> maxLon2D = max(lon2d) + extra<br><br> prc_region = prc_trmm(<b>{minLat2D:maxLat2D},{minLon2D:maxLon2D}</b>)<br></div><div> printVarSummary(prc_region)</div><div> printMinMax(prc_region,0)<br></div><div><i></i></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Apr 27, 2019 at 7:49 PM Mirce Morales <<a href="mailto:mirce.morales@gmail.com" target="_blank">mirce.morales@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi all,<div><br></div><div>I am trying to regrid precipitation data from TRMM3B42 using ESMF bilinear regridding, however, when I try to generate the weights I get the following error:</div><div><br></div><div><b>curvilinear_to_SCRIP: Opt@Mask2D is not the correct dimensionality</b><br></div><div><br></div><div><div>I successfully did the regridding in the past for the same data, but now some attributes of the data have changed for the period of time I interested in and I am getting the last error.</div><br class="gmail-m_-3405008509287572142gmail-m_-8186778735787386450gmail-m_-4197235336556974410gmail-Apple-interchange-newline"></div><div>These are the attributes of my data:</div><div><i>netcdf \3B42.20090101.00.7A.HDF {</i></div><div><i>dimensions:</i></div><div><i> nlon = 1440 ;</i></div><div><i> nlat = 400 ;</i></div><div><i>variables:</i></div><div><i> float precipitation(nlon, nlat) ;</i></div><div><i> precipitation:units = "mm/hr" ;</i></div><div><i> precipitation:coordinates = "nlon nlat" ;</i></div><div><i> precipitation:_FillValue = -9999.9f ;</i></div><div><i> float nlon(nlon) ;</i></div><div><i> nlon:long_name = "longitude" ;</i></div><div><i> nlon:standard_name = "longitude" ;</i></div><div><i> nlon:units = "degrees_east" ;</i></div><div><i> float nlat(nlat) ;</i></div><div><i> nlat:long_name = "latitude" ;</i></div><div><i> nlat:standard_name = "latitude" ;</i></div><div><i> nlat:units = "degrees_north" ;</i></div><div><i><br></i></div><div>And this is my script:</div><div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl"</div><div><br></div><div>begin</div><div><br></div><div>;----------------------------------------------------------------------</div><div>; User settings</div><div>;----------------------------------------------------------------------</div><div><br></div><div> ;---------------------------------------------------------------;</div><div> ; Set source and destination grid filenames. ;</div><div> ; Define weight filename. ;</div><div> ;---------------------------------------------------------------;</div><div> interp_opt = "bilinear"</div><div> wgtFileName = "./TRMM2WRFHydro_weight_"+interp_opt+".nc"</div><div><br></div><div> srcGridName = "./3B42.20090101.00.7A.HDF.nc4"</div><div> if ( .not.isfilepresent( srcGridName ) ) then</div><div> print( " ... source grid file not found : "+ srcGridName )</div><div> exit</div><div> end if</div><div><br></div><div> dstGridName = "/glade/work/mirce/DOMAINS/DOMAIN_Files_250m_200/<a href="http://geo_em.d04.nc" target="_blank">geo_em.d04.nc</a>"</div><div> if ( .not.isfilepresent( dstGridName ) ) then</div><div> print( " ... destination grid file not found : "+ dstGridName )</div><div> exit</div><div> end if</div><div><br></div><div> ;---------------------------------------------------------------;</div><div> ; Field names for lat and lon coordinates in the source file. ;</div><div> ;---------------------------------------------------------------;</div><div> LatName = "nlat"</div><div> LonName = "nlon"</div><div><br></div><div>;----------------------------------------------------------------------</div><div>; Convert source grid to a SCRIP convention file.</div><div>;----------------------------------------------------------------------</div><div> src_file = addfile(srcGridName,"r")</div><div> vNames = getfilevarnames( src_file )</div></div><div><div><br></div><div> if ( isfilevar( src_file, LatName ) .and. isfilevar( src_file, LonName ) ) then</div><div> src_lat = src_file->$LatName$</div><div> src_lon = src_file->$LonName$</div><div> else</div><div> print( " ... no such lat/lon fieldnames" )</div><div> exit</div><div> end if</div><div><br></div><div> if ( isfilevar( src_file, "precipitation" ) ) then</div><div> test_mask = src_file->precipitation(:,:)</div><div> else</div><div> print( " ... no such data field " )</div><div> exit</div><div> end if</div><div><br></div><div> Opt = True</div><div> Opt@Mask2D = where(.not.ismissing(test_mask),1,0)</div><div> Opt@SrcRegional = False</div><div> Opt@ForceOverwrite = True</div><div> Opt@PrintTimings = True</div><div> Opt@Title = "TRMM"</div><div><br></div><div> src_SCRIP_filename = "SCRIP_TRMM_"+interp_opt+".nc"</div><div> rectilinear_to_SCRIP( src_SCRIP_filename, src_lat, src_lon, Opt)</div><div><br></div><div> delete(Opt)</div><div><br></div><div>;----------------------------------------------------------------------</div><div>; Convert destination grid to a SCRIP convention file.</div><div>;----------------------------------------------------------------------</div><div> dst_file = addfile(dstGridName,"r")</div><div><br></div><div> if ( isfilevar( dst_file, "XLAT" ) .and. .not. isfilevar( dst_file, "XLAT_M") ) then</div><div> dst_lat = dst_file->XLAT(0,:,:)</div><div> dst_lon = dst_file->XLONG(0,:,:)</div></div><div><div> end if</div><div><br></div><div> Opt = True</div><div> Opt@DstRegional = True</div><div> Opt@ForceOverwrite = True</div><div> Opt@PrintTimings = True</div><div> Opt@Title = dstGridName</div><div><br></div><div> dst_SCRIP_filename = "SCRIP_WRFHydro_"+interp_opt+".nc"</div><div> curvilinear_to_SCRIP( dst_SCRIP_filename, dst_lat, dst_lon,Opt)</div><div><br></div><div> delete(Opt)</div><div><br></div><div>;----------------------------------------------------------------------</div><div>; Generate the weights that take you from the source grid to</div><div>; destination degree grid.</div><div>;----------------------------------------------------------------------</div><div> Opt = True</div><div> Opt@InterpMethod = interp_opt</div><div> Opt@DstRegional = True</div><div> Opt@ForceOverwrite = True</div><div> Opt@PrintTimings = True</div><div> Opt@Debug = True</div><div><br></div><div> ESMF_regrid_gen_weights( src_SCRIP_filename, dst_SCRIP_filename, wgtFileName, Opt)</div><div><br></div><div> delete(Opt)</div><div><br></div><div>;----------------------------------------------------------------------</div><div>;----------------------------------------------------------------------</div><div>end</div></div><div><br></div><div>If it's helpful, my data is in the following path in Cheyenne:</div><div><i>/glade/scratch/mirce/LaSierra/FullDomainForcing/TRMM_3B24/Test<br></i></div><div><br></div><div>I will appreciate any help about how to fix this error.</div><div><br></div><div>Thanks!,</div><div>Mirce.</div><div><br></div><div> <br></div></div></div></div></div></div></div></div>
_______________________________________________<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/mailman/listinfo/ncl-talk</a><br>
</blockquote></div>