Commit efa4313b6aa9871c80e68b82c359ac65e8bf7303

Authored by dumoda01
1 parent f6be7fd1
Exists in master and in 1 other branch snow

Ajout du script icec2gotm.m

Showing 1 changed file with 109 additions and 0 deletions   Show diff stats
scripts/matlab/icec2gotm.m 0 → 100755
... ... @@ -0,0 +1,109 @@
  1 +function icec2gotm
  2 +% Load, interpolate in time and calculate extinction coefficient from
  3 +% ice concentration data of Amundsen Gulf for the year 2004.
  4 +
  5 +% Dany DUMONT
  6 +% 01/08/2008: creation
  7 +% 01/10/2008: treatment of CIS weekly data for 2004-2008
  8 +% 01/03/2011: minor changes
  9 +% ______________________________________________________________________
  10 +
  11 +
  12 +% Format weekly ice concentration data from the Canadian Ice Service (CIS)
  13 +
  14 +% 2004
  15 +init_date = datenum([2004 01 01 00 00 00]);
  16 +time = [init_date:1/24:init_date+366-1/24];
  17 +timevec = datevec(time);
  18 +
  19 +load cis_icec_2004_weekly.txt
  20 +icec = cis_icec_2004_weekly(:,2);
  21 +
  22 +% Interpolate weekly data to hourly frequency
  23 +icec = interp(icec,7);
  24 +icec(end+1) = icec(1);
  25 +icec(end+1) = icec(2); % leap year
  26 +icec = interp(icec,24);
  27 +
  28 +fid = fopen('cis_icec_2004.dat', 'wt');
  29 +fprintf(fid, '%f\t%f\n', icec');
  30 +fclose(fid);
  31 +
  32 +clear icec init_date time timevec
  33 +
  34 +% 2005
  35 +init_date = datenum([2005 01 01 00 00 00]);
  36 +time = [init_date:1/24:init_date+365-1/24];
  37 +timevec = datevec(time);
  38 +
  39 +load cis_icec_2005_weekly.txt
  40 +icec = cis_icec_2005_weekly(:,2);
  41 +
  42 +% Interpolate weekly data to daily frequency
  43 +icec = interp(icec,7);
  44 +icec(end+1) = icec(1);
  45 +icec = interp(icec,24);
  46 +
  47 +fid = fopen('cis_icec_2005.dat', 'wt');
  48 +fprintf(fid, '%f\n', icec');
  49 +fclose(fid);
  50 +
  51 +clear icec init_date time timevec
  52 +
  53 +% 2006
  54 +init_date = datenum([2006 01 01 00 00 00]);
  55 +time = [init_date:1/24:init_date+365-1/24];
  56 +timevec = datevec(time);
  57 +
  58 +load cis_icec_2006_weekly.txt
  59 +icec = cis_icec_2006_weekly(:,2);
  60 +
  61 +% Interpolate weekly data to daily frequency
  62 +icec = interp(icec,7);
  63 +icec(end+1) = icec(1);
  64 +icec = interp(icec,24);
  65 +
  66 +fid = fopen('cis_icec_2006.dat', 'wt');
  67 +fprintf(fid, '%f\n', icec');
  68 +fclose(fid);
  69 +
  70 +clear icec init_date time timevec
  71 +
  72 +% 2007
  73 +init_date = datenum([2007 01 01 00 00 00]);
  74 +time = [init_date:1/24:init_date+365-1/24];
  75 +timevec = datevec(time);
  76 +
  77 +load cis_icec_2007_weekly.txt
  78 +icec = cis_icec_2007_weekly(:,2);
  79 +
  80 +% Interpolate weekly data to daily frequency
  81 +icec = interp(icec,7);
  82 +icec(end+1) = icec(1);
  83 +icec = interp(icec,24);
  84 +
  85 +fid = fopen('cis_icec_2007.dat', 'wt');
  86 +fprintf(fid, '%f\n', icec');
  87 +fclose(fid);
  88 +
  89 +clear icec init_date time timevec
  90 +
  91 +% 2008
  92 +init_date = datenum([2008 01 01 00 00 00]);
  93 +time = [init_date:1/24:init_date+366-1/24];
  94 +timevec = datevec(time);
  95 +
  96 +load cis_icec_2008_weekly.txt
  97 +icec = cis_icec_2008_weekly(:,2);
  98 +
  99 +% Interpolate weekly data to daily frequency
  100 +icec = interp(icec,7);
  101 +icec(end+1) = icec(1);
  102 +icec(end+1) = icec(2); % leap year
  103 +icec = interp(icec,24);
  104 +
  105 +fid = fopen('cis_icec_2008.dat', 'wt');
  106 +fprintf(fid, '%f\n', icec');
  107 +fclose(fid);
  108 +
  109 +
... ...