Home > atmlab > time > mjd2season.m

mjd2season

PURPOSE ^

MJD2SEASON Conversion of MJD to season

SYNOPSIS ^

function s = mjd2season(mjd,month1)

DESCRIPTION ^

 MJD2SEASON   Conversion of MJD to season  

    Returns a number indicating the season. The year is divided into 4
    seasons, where the months per season can be changed by *month1*.

 FORMAT   s = mjd2season(mjd,month1)
        
 OUT   s        Season number.
 IN    mjd      Modified julian date. Can be a vector.
 OPT   month1   Start month of "season year". Default is 12 which
                gives the seasons DJF, MAM, JJA and SON.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

mjd2season.m

SOURCE CODE ^

0001 % MJD2SEASON   Conversion of MJD to season
0002 %
0003 %    Returns a number indicating the season. The year is divided into 4
0004 %    seasons, where the months per season can be changed by *month1*.
0005 %
0006 % FORMAT   s = mjd2season(mjd,month1)
0007 %
0008 % OUT   s        Season number.
0009 % IN    mjd      Modified julian date. Can be a vector.
0010 % OPT   month1   Start month of "season year". Default is 12 which
0011 %                gives the seasons DJF, MAM, JJA and SON.
0012 
0013 % 2006-03-31   Created by Patrick Eriksson.
0014 
0015 function s = mjd2season(mjd,month1)
0016 %
0017 if nargin < 2
0018   month1 = 12;
0019 end
0020                                                                             %&%
0021 rqre_datatype( mjd, @isnumeric );                                           %&%
0022 rqre_alltypes( month1, {@istensor0,@iswhole} );                             %&%
0023 rqre_in_range( month1, 1, 12 );                                             %&%
0024 
0025 
0026 m = floor(mjd2month(mjd)) - month1 + 1;
0027 
0028 ind = find( m<1 );
0029 
0030 m(ind) = m(ind)+12;
0031 
0032 s = ceil( m/3 );
0033 
0034 
0035

Generated on Mon 15-Sep-2014 13:31:28 by m2html © 2005