Home > fvcom_prepro > example_FVCOM_wind_ts_speed.m

example_FVCOM_wind_ts_speed

PURPOSE ^

example file for FVCOM, time-varying/spatially constant wind forcing as speed

SYNOPSIS ^

function example_FVCOM_wind_ts_speed

DESCRIPTION ^

 example file for FVCOM, time-varying/spatially constant wind forcing as speed

 function example_FVCOM_wind_ts_speed

 DESCRIPTION:
    Write a time-varying, spatially constant wind file
    This is TEMPLATE program to be used as an example
    Do not commit your user-defined programs to the repository
    It requires USER Modification to work 

 INPUT
   
 OUTPUT:
    NetCDF WindFile

 EXAMPLE USAGE
    example_FVCOM_wind_ts_speed

 Author(s):  
    Geoff Cowles (University of Massachusetts Dartmouth)

 Revision history
   
==============================================================================
warning off

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function example_FVCOM_wind_ts_speed
0002 
0003 % example file for FVCOM, time-varying/spatially constant wind forcing as speed
0004 %
0005 % function example_FVCOM_wind_ts_speed
0006 %
0007 % DESCRIPTION:
0008 %    Write a time-varying, spatially constant wind file
0009 %    This is TEMPLATE program to be used as an example
0010 %    Do not commit your user-defined programs to the repository
0011 %    It requires USER Modification to work
0012 %
0013 % INPUT
0014 %
0015 % OUTPUT:
0016 %    NetCDF WindFile
0017 %
0018 % EXAMPLE USAGE
0019 %    example_FVCOM_wind_ts_speed
0020 %
0021 % Author(s):
0022 %    Geoff Cowles (University of Massachusetts Dartmouth)
0023 %
0024 % Revision history
0025 %
0026 %==============================================================================
0027 %warning off
0028 subname = 'example_FVCOM_wind_ts';
0029 fprintf('\n')
0030 fprintf(['begin : ' subname '\n'])
0031 
0032 %------------------------------------------------------------------------------
0033 % create a dataset
0034 %------------------------------------------------------------------------------
0035 
0036 % make a timeframe
0037 % tbeg = greg2julian(2009,1,1,0,0,0)-2400000.5;
0038 % tend = greg2julian(2010,1,1,0,0,0)-2400000.5;
0039 tbeg = 0;
0040 tend = 31;
0041 time = tbeg:1:tend;
0042 nTimes = numel(time);
0043 
0044 % make up a fake time varying wind in m/s at 10-m above the water surface
0045 u10 = 10*ones(nTimes,1); 
0046 v10 = zeros(nTimes,1); 
0047 
0048 %------------------------------------------------------------------------------
0049 % write output to time-varying, spatially constant FVCOM wind file
0050 %------------------------------------------------------------------------------
0051 fvcom_forcing_file = 'tst_wind.nc'; 
0052 nc = netcdf(fvcom_forcing_file, 'clobber');            
0053 nc.references = 'http://fvcom.smast.umassd.edu'; 
0054 nc.source = 'single-point time-dependent surface forcing'; 
0055 nc.institution = 'School for Marine Science and Technology' ;
0056 nc.history = 'generated using the fvcom-toolbox';
0057 
0058 
0059   
0060 % dimensions
0061 nc('time') = 0;
0062 
0063 % time vars
0064 nc{'time'} = ncfloat('time');
0065 nc{'time'}.long_name = 'time';
0066 nc{'time'}.units = 'days since 1858-11-17 00:00:00';
0067 nc{'time'}.format = 'modified julian day (MJD)';
0068 nc{'time'}.time_zone = 'UTC';
0069   
0070 nc{'Itime'} = ncint('time');
0071 nc{'Itime'}.units = 'days since 1858-11-17 00:00:00';
0072 nc{'Itime'}.format = 'modified julian day (MJD)';
0073 nc{'Itime'}.time_zone = 'UTC';
0074 
0075 nc{'Itime2'} = ncint('time');
0076 nc{'Itime2'}.units = 'msec since 00:00:00';
0077 nc{'Itime2'}.time_zone = 'UTC';
0078 
0079 
0080 nc{'U10'} = ncfloat('time');
0081 nc{'U10'}.long_name = 'Eastward Wind Velocity';
0082 nc{'U10'}.standard_name = 'Wind Velocity';
0083 nc{'U10'}.units = 'm/s';
0084 nc{'U10'}.type = 'data';
0085 
0086 nc{'V10'} = ncfloat('time');
0087 nc{'V10'}.long_name = 'Northward Wind Velocity';
0088 nc{'V10'}.standard_name = 'Wind Velocity';
0089 nc{'V10'}.units = 'm/s';
0090 nc{'V10'}.type = 'data';
0091 
0092 % dump time
0093 nc{'time'}(1:nTimes) = time; 
0094 nc{'Itime'}(1:nTimes) = floor(time); 
0095 nc{'Itime2'}(1:nTimes) = mod(time,1)*24*3600*1000.;
0096 
0097 nc{'U10'}(1:nTimes) = u10;  
0098 nc{'V10'}(1:nTimes) = v10; 
0099 
0100 ierr = close(nc);
0101 
0102 fprintf(['end   : ' subname '\n'])
0103 
0104 
0105

Generated on Thu 19-Mar-2015 12:20:56 by m2html © 2005