Commit 1e8e1d39 authored by Dany Dumont's avatar Dany Dumont

Ajout du script ecmwf2gotm.m

parent 9995008e
function ecmwf2gotm(region,file,lon,lat,year) function ecmwf2gotm(region,file,lon,lat,year)
% Format meteorological variables from ECMWF for GOTM. % ECMWF2GOTM - Format meteorological variables from ECMWF for GOTM. It uses
% % data archived on brandypot.uqar.ca. Variables are:
% Variables:
% %
% T2M 2 meter temperature (degK) % T2M 2 meter temperature (degK)
% U10 10 meter zonal wind component (m/s) % U10 10 meter zonal wind component (m/s)
...@@ -10,7 +9,9 @@ function ecmwf2gotm(region,file,lon,lat,year) ...@@ -10,7 +9,9 @@ function ecmwf2gotm(region,file,lon,lat,year)
% MSL Mean sea level pressure (Pa) % MSL Mean sea level pressure (Pa)
% TCC Total cloud cover (0-1) % TCC Total cloud cover (0-1)
% %
% Function arguments % Syntax: ecmwf2gotm(region,file,lon,lat,year)
%
% Inputs:
% %
% region 'pc' - Potter Cove % region 'pc' - Potter Cove
% 'ap' - Antarctic Peninsula and Weddell Sea % 'ap' - Antarctic Peninsula and Weddell Sea
...@@ -22,14 +23,29 @@ function ecmwf2gotm(region,file,lon,lat,year) ...@@ -22,14 +23,29 @@ function ecmwf2gotm(region,file,lon,lat,year)
% lon longitude in degrees_east (0-360) % lon longitude in degrees_east (0-360)
% lat latitude in degrees_north (-90-90) % lat latitude in degrees_north (-90-90)
% year year to be extracted % year year to be extracted
% %
% Outputs:
%
% output1 - Description
% output2 - Description
%
% Example:
% ecmwf2gotm('gsl',
%
% Other m-files required: Netcdf Toolbox
% Subfunctions: none
% MAT-files required: none
%
% See also: NARR2GOTM, NCEP2GOTM, ICEC2GOTM
%
% cf. data-portal.ecmwf.int/data/d/interim_daily/ % cf. data-portal.ecmwf.int/data/d/interim_daily/
% cf. GOTM % cf. GOTM
% Uses the netcdf toolbox % Uses the netcdf toolbox
% Dany DUMONT % Author: Dany Dumont
% 14/05/2011: Creation % email: dany_dumont@uqar.ca
% 24/01/2013: Standardized and adapted to the data file organization % Website: http://www.ismer.ca/dumont-dany
% May 2011; Last revision: 15-October-2014
% ______________________________________________________________________ % ______________________________________________________________________
yrstr = num2str(year); yrstr = num2str(year);
...@@ -51,7 +67,7 @@ time = (init_date:6/24:init_date+nod-6/24)'; ...@@ -51,7 +67,7 @@ time = (init_date:6/24:init_date+nod-6/24)';
timevec = datevec(time); timevec = datevec(time);
%tlength = length(time); %tlength = length(time);
datadir = ['/sas/usagers/dumoda01/shared/data/ecmwf/',region,'/6hourly/']; datadir = ['/sas/usagers/share_lasso/data/ecmwf/',region,'/6hourly/'];
ncfile = [datadir,'ecmwf_',region,'_meteo_',yrstr,'.nc']; ncfile = [datadir,'ecmwf_',region,'_meteo_',yrstr,'.nc'];
hlon = double(nc_varget(ncfile,'longitude')); hlon = double(nc_varget(ncfile,'longitude'));
...@@ -73,9 +89,9 @@ tol = 0.8; ...@@ -73,9 +89,9 @@ tol = 0.8;
i = find(hlon < lon + tol & hlon > lon - tol,1); i = find(hlon < lon + tol & hlon > lon - tol,1);
j = find(hlat < lat + tol & hlat > lat - tol,1); j = find(hlat < lat + tol & hlat > lat - tol,1);
if isempty(i) || isempty(j) if isempty(i) || isempty(j)
disp('** Error : Can not find the specified lat/lon location.' ) disp('** Error : Can''t find the specified lat/lon location. ')
disp('** Verify that you have specified the longitude in the') disp('** Verify that you have specified the longitude in the')
disp('** [0-360] degree interval (e.g. 296 instead of -64)' ) disp('** [0-360] degree interval (e.g. 296 instead of -64). ')
return return
end end
...@@ -93,4 +109,4 @@ array = cat(2,timevec,u10,v10,msl,t2m,d2m,tcc); ...@@ -93,4 +109,4 @@ array = cat(2,timevec,u10,v10,msl,t2m,d2m,tcc);
fid = fopen(['ecmwf_',file,'_meteo_',yrstr,'.dat'], 'w'); fid = fopen(['ecmwf_',file,'_meteo_',yrstr,'.dat'], 'w');
fprintf(fid, '%4.0f-%02.0f-%02.0f %02.0f:%02.0f:%02.0f\t%3.2f\t%3.2f\t%4.1f\t%3.2f\t%3.2f\t%1.2f\n', ... fprintf(fid, '%4.0f-%02.0f-%02.0f %02.0f:%02.0f:%02.0f\t%3.2f\t%3.2f\t%4.1f\t%3.2f\t%3.2f\t%1.2f\n', ...
array'); array');
fclose(fid); fclose(fid);
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment