Home > swan_scripts > get_fetch.m

get_fetch

PURPOSE ^

SYNOPSIS ^

function [fetch] = get_fetch(f,uwind,vwind,depth)

DESCRIPTION ^

 Determine fetch for given Cartesian wind speed or stress components 

 function get_fetch(uwind,vwind,f) 

 DESCRIPTION:
   Display fetch relationship from fetch object 

 INPUT 
   f     = fetch structure 
   uwind = wind U10 or stress or other x-component
   vwind = wind y-component
   depth = [optional] depth at the station (default = uses bathymetry)
   

 OUTPUT:
   fetch in meters for that wind stress 

 EXAMPLE USAGE

   fetch = get_fetch(myfetch,10.,0.,2.0)

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

 Revision history
   
==============================================================================

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [fetch] = get_fetch(f,uwind,vwind,depth) 
0002 %
0003 % Determine fetch for given Cartesian wind speed or stress components
0004 %
0005 % function get_fetch(uwind,vwind,f)
0006 %
0007 % DESCRIPTION:
0008 %   Display fetch relationship from fetch object
0009 %
0010 % INPUT
0011 %   f     = fetch structure
0012 %   uwind = wind U10 or stress or other x-component
0013 %   vwind = wind y-component
0014 %   depth = [optional] depth at the station (default = uses bathymetry)
0015 %
0016 %
0017 % OUTPUT:
0018 %   fetch in meters for that wind stress
0019 %
0020 % EXAMPLE USAGE
0021 %
0022 %   fetch = get_fetch(myfetch,10.,0.,2.0)
0023 %
0024 % Author(s):
0025 %    Geoff Cowles (University of Massachusetts Dartmouth)
0026 %
0027 % Revision history
0028 %
0029 %==============================================================================
0030 
0031 %-------------------------------------------------
0032 % set dimensions
0033 %-------------------------------------------------
0034 
0035 [~,nZeta] = size(f.fetch);
0036 
0037 %-------------------------------------------------
0038 % find nearest points in theta/zeta space
0039 %-------------------------------------------------
0040 
0041 % wind angle (-pi < wind angle < pi)
0042 wangle = atan2(vwind,uwind);
0043 [~,itheta] = min( abs(wangle-f.theta));
0044 
0045 % zeta
0046 if(exist('depth'));
0047   myzeta = f.zobs + depth;
0048 else
0049   myzeta = 0.0;
0050 end;
0051 [~,izeta] = min( abs(myzeta-f.zeta));
0052 
0053 % set fetch
0054 fetch = f.fetch(itheta,izeta);
0055

Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005