0001 function example_FVCOM_wind_ts
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027 warning off
0028 subname = 'example_FVCOM_wind_ts';
0029 global ftbverbose;
0030 if(ftbverbose);
0031 fprintf('\n')
0032 fprintf(['begin : ' subname '\n'])
0033 end;
0034
0035
0036
0037
0038
0039
0040
0041
0042 tbeg = 0;
0043 tend = 31;
0044 time = tbeg:(1./24.):tend;
0045 nTimes = prod(size(time));
0046
0047
0048 taux = 0.25*(cos( ((time-time(1))*2*pi)/7)) + .15*(cos( ((time-time(1))*2*pi)/360));
0049 tauy = 0.25*(sin( ((time-time(1))*2*pi)/7)) + .15*(sin( ((time-time(1))*2*pi)/360));
0050
0051
0052 subplot(2,1,1)
0053 plot(time-time(1),taux,'k');
0054 subplot(2,1,2)
0055 plot(time-time(1),tauy,'r');
0056
0057
0058
0059
0060 fvcom_forcing_file = 'tst_wind.nc';
0061 nc = netcdf(fvcom_forcing_file, 'clobber');
0062 nc.references = 'http://fvcom.smast.umassd.edu';
0063 nc.source = 'single-point time-dependent surface forcing';
0064 nc.institution = 'School for Marine Science and Technology' ;
0065 nc.history = 'generated using the fvcom-toolbox';
0066
0067
0068
0069
0070 nc('time') = 0;
0071
0072
0073 nc{'time'} = ncfloat('time');
0074 nc{'time'}.long_name = 'time';
0075 nc{'time'}.units = 'days since 1858-11-17 00:00:00';
0076 nc{'time'}.format = 'modified julian day (MJD)';
0077 nc{'time'}.time_zone = 'UTC';
0078
0079 nc{'Itime'} = ncint('time');
0080 nc{'Itime'}.units = 'days since 1858-11-17 00:00:00';
0081 nc{'Itime'}.format = 'modified julian day (MJD)';
0082 nc{'Itime'}.time_zone = 'UTC';
0083
0084 nc{'Itime2'} = ncint('time');
0085 nc{'Itime2'}.units = 'msec since 00:00:00';
0086 nc{'Itime2'}.time_zone = 'UTC';
0087
0088
0089 nc{'uwind_stress'} = ncfloat('time');
0090 nc{'uwind_stress'}.long_name = 'Eastward Wind Stress';
0091 nc{'uwind_stress'}.standard_name = 'Wind Stress';
0092 nc{'uwind_stress'}.units = 'Pa';
0093 nc{'uwind_stress'}.type = 'data';
0094
0095 nc{'vwind_stress'} = ncfloat('time');
0096 nc{'vwind_stress'}.long_name = 'Northward Wind Stress';
0097 nc{'vwind_stress'}.standard_name = 'Wind Stress';
0098 nc{'vwind_stress'}.units = 'Pa';
0099 nc{'vwind_stress'}.type = 'data';
0100
0101
0102 nc{'time'}(1:nTimes) = time;
0103 nc{'Itime'}(1:nTimes) = floor(time);
0104 nc{'Itime2'}(1:nTimes) = mod(time,1)*24*3600*1000.;
0105
0106 nc{'uwind_stress'}(1:nTimes) = taux;
0107 nc{'vwind_stress'}(1:nTimes) = tauy;
0108
0109 ierr = close(nc);
0110
0111 if(ftbverbose);
0112 fprintf(['end : ' subname '\n'])
0113 end;
0114
0115
0116