0001 function []=write_gnome_curv(cdfout,lon,lat,jdmat,u,v,depth,sigma,title);
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025 nc=netcdf(cdfout,'clobber');
0026
0027 [nt,nz,ny,nx]=size(u);
0028
0029
0030 nc('y')=ny;
0031 nc('x')=nx;
0032 nc('sigma')=nz;
0033 nc('time')=0;
0034
0035
0036
0037 nc{'lat'}=ncfloat('y','x');
0038 nc{'lat'}.long_name='Latitude';
0039 nc{'lat'}.units='degrees_north';
0040
0041 nc{'lon'}=ncfloat('y','x');
0042 nc{'lon'}.long_name='Longitude';
0043 nc{'lon'}.units='degrees_east';
0044
0045 nc{'sigma'}=ncfloat('sigma');
0046 nc{'sigma'}.long_name='Sigma';
0047 nc{'sigma'}.units='sigma_level';
0048 nc{'sigma'}.positive='down';
0049 nc{'sigma'}.standard_name='ocean_sigma_coordinate';
0050 nc{'sigma'}.formula_terms='sigma: sigma eta:zeta depth:depth';
0051
0052 nc{'mask'}=ncfloat('y','x');
0053 nc{'mask'}.long_name='land mask';
0054 nc{'mask'}.units='nondimensional';
0055
0056 nc{'time'}=ncfloat('time');
0057 nc{'time'}.long_name='Time';
0058 nc{'time'}.units=['hours since 2000-01-01 00:00:00 00:00'];
0059
0060 nc{'depth'}=ncfloat('y','x');
0061 nc{'depth'}.long_name='Bathymetry';
0062 nc{'depth'}.units='meters';
0063
0064 nc{'u'}=ncshort('time','sigma','y','x');
0065 nc{'u'}.long_name='Eastward Water Velocity';
0066 nc{'u'}.units='m/s';
0067 nc{'u'}.FillValue_=ncshort(-9999);
0068 nc{'u'}.scale_factor=ncfloat(0.01);
0069 nc{'u'}.add_offset=ncfloat(0.0);
0070
0071
0072 nc{'v'}=ncshort('time','sigma','y','x');
0073 nc{'v'}.long_name='Northward Water Velocity';
0074 nc{'v'}.units='m/s';
0075 nc{'v'}.FillValue_=ncshort(-9999);
0076 nc{'v'}.scale_factor=ncfloat(0.01);
0077 nc{'v'}.add_offset=ncfloat(0.0);
0078
0079
0080 nc.Conventions='COARDS';
0081 nc.file_type='Full_Grid';
0082 nc.grid_type='CURVILINEAR';
0083 nc.z_type='sigma';
0084 nc.model='POM';
0085 nc.title=title;
0086
0087
0088 iland=find(isnan(depth) | depth==-99999.);
0089
0090 mask=ones(size(depth));
0091 mask(iland)=0;
0092
0093 nc{'time'}(1:nt)=(jdmat-datenum([2000 1 1 0 0 0]))*24;
0094 nc{'lat'}(:)=lat;
0095 nc{'lon'}(:)=lon;
0096 nc{'sigma'}(:)=abs(sigma);
0097 nc{'depth'}(:)=depth;
0098 nc{'mask'}(:)=mask;
0099 nc{'u',1}(1:nt,:,:,:)=u;
0100 nc{'v',1}(1:nt,:,:,:)=v;
0101
0102 close(nc);