gfile='bump_grd.nc'; nc=netcdf(gfile); % read the rho points lon/lat and convert to x,y UTM lon=nc{'lon_rho'}(:); lat=nc{'lat_rho'}(:); lat=nc{'mask_rho'}(:); h=nc{'h'}(:); utm_zone=utmzone(lon(1)); [xutm,yutm]=ll2utm(lon,lat,utm_zone); x=xutm.'; y=yutm.'; h(~mask)=-999.; h=h.'; [m,n]=size(x); % set sediment initial depth sed=20.0*ones(size(h)); % initial 20 m thick sediment % write to Delft3D files % not sure why we need this extra layer of -999, but we seem to need it h(m+1,:)=-999.; h(:,n+1)=-999.; sed(m+1,:)=-999.; sed(:,n+1)=-999.; ok1=wlgrid('write','b01',x,y) % write grid ok2=wldep ('write','b01.dep',h) % write initial depth ok3=wldep ('write','b01.sdb',sed) % write initial sed thickness