ITAS Automatic Weather Stations: Difference between revisions

From gfi
No edit summary
No edit summary
Line 33: Line 33:


'''Matlab routines'''
'''Matlab routines'''
reading AWS data from netcdf files


<pre>% read_AWS.m
<pre>% read_AWS.m
Line 170: Line 172:


% fin
% fin
</pre>
reading AWS data from raw logger files
<pre>
clear
% Change to corresponding data directory
cd('../../data/Incoming/')
% Get names of all files of interest
file='CR1000_1436_Minutt.dat';
% read data
data_all = importdata(file);
% Get the specific variables from file
data.P = data_all.data(:,1);  % Pressure                      [hPa]
data.TA = data_all.data(:,2);  % Temperature                  [deg C]
data.RH = data_all.data(:,3);  % Relative Humidity            [%]
data.WS = data_all.data(:,4);  % Wind Speed                    [m/s]
data.WD = data_all.data(:,5);  % Wind Direction                [deg]
data.RR = data_all.data(:,6);  % Rain Rate                    [mm]
data.GHI = data_all.data(:,7); % Global Horizontal Irradiation [W/m2]
% Get the timestamps
data.TIME = datenum(data_all.textdata(5:end,1),'yyyy-mm-dd HH:MM:SS');
tstart = datenum(2019,2,22,20,0,0);
tend  = datenum(2019,3,3,15,0,0);
% Plot Data of interest
figure(1)
subplot(2,1,1),plot(data.TIME,data.P)
datetick('x')
xlim([tstart,tend])
subplot(2,1,2),plot(data.TIME,data.TA)
ylim([-1,13])
datetick('x')
xlim([tstart,tend])
</pre>
</pre>

Revision as of 10:22, 13 January 2020

GFI has a set of 6 automatic weather stations composed of robust standard instrumentation. Measured parameters include pressure, air temperature, relative humidity, wind speed and direction, precipitation and global radiation.

Itas forde.png

In detail, the AWS includes the following instruments:

Instrument name Function
Campbell Scientific CR1000 datalogger
RM Young 61302V trykksensor
S+S Regeltechnik HTF 100 Pt100 temperatursensor
Vaisala HMP155 temperatur- og fuktighetssensor
RM Young 5106-45 Alpine vindhastighets- og vindretningssensor
Pessl IM523 nedbørssensor
Apogee SP110 strålingssensor


The weather station configuration is fully documented in the attached manual:

File:ITAS_GFI_Manual_20160518.pdf (in Norwegian)

The weather stations are configured to acquire 10 min measurements, and transfer the logger files to GFI via mobile network once per day at 11:00 UTC.

Routines are available at GFI to convert from the ASCII format files to netCDF files will full metadata information.

Matlab routines

reading AWS data from netcdf files

% read_AWS.m
%--------------------------------
% Description
% read AWS data
% station: Station serial number, e.g. 1432
% startdate: datenum of first day
% enddate: optional: datenum of last day
%--------------------------------
% HS, Thu Feb 28 16:30:27 CET 2019 
%--------------------------------

function data=read_AWS(station,startdate,varargin)

  if nargin==2,
    enddate=startdate;
  elseif nargin==3,
    enddate=varargin{1};
  else
    error('Wrong number of arguments in read_AWS.m');
  end

  for dat=startdate:enddate,

    % open file and read variables
    fname=sprintf('AWS_%4d/CR1000_%4d_Minutt_%s.nc',station,station,datestr(dat,'yyyymmdd'));
    ncid=netcdf.open(fname,'NOWRITE');
    % check that file exists
    if ncid<0,
      error('File %s not found.',fname);
    end
    % get all variable IDs
    varids=netcdf.inqVarIDs(ncid);
    % loop through all variables
    for i=varids,
      [varname,xtype,dimids,natts] = netcdf.inqVar(ncid,i);
      if dat==startdate,
	data.(varname)=netcdf.getVar(ncid,i,'double');
      else
	data.(varname)=[data.(varname); netcdf.getVar(ncid,i,'double')];
      end
    end
    netcdf.close(ncid);

  end

  % set missing data if T<-98
  midx=find(data.T<-98);
  fnames=fields(data);
  for f=1:length(fnames),
    data.(fnames{f})(midx)=NaN;
  end

end

% fin

plotting AWS data from netcdf files

% plot_AWS.m
%--------------------------------
% Description
% read and plot AWS data
% set station serial numbers and 
% dates
%--------------------------------
% HS, Thu Feb 28 16:30:27 CET 2019 
%--------------------------------

% set station names
station1=1432;
station2=1436;

% set date
dat1=datenum('2019-02-22');
dat2=datenum('2019-02-27');

% get data
data1=read_AWS(station1,dat1,dat2);
data2=read_AWS(station2,dat1,dat2);

% print out available variables
data1

% plot met overview
width=20;
height=30;
handle=figure(1);
set(handle,'color','w')
set(handle,'PaperUnits', 'centimeters');
set(handle,'PaperSize', [width height]);
set(handle,'PaperPosition', [0.5 0.5 width-0.5 height-0.5]);
 
clf
subplot(4,1,1);
plot(data1.time,data1.T,'r-');
datetick('x');
set(gca,'TickDir','out');
hold on
plot(data2.time,data2.T,'k-');
datetick('x');
set(gca,'TickDir','out');
ylabel('Air temperature / deg C');
subplot(4,1,2);
plot(data1.time,data1.FF,'r-');
datetick('x');
set(gca,'TickDir','out');
hold on
plot(data2.time,data2.FF,'k-');
ylabel('Wind speed / m s-1');
datetick('x');
set(gca,'TickDir','out');
subplot(4,1,3);
plot(data1.time,data1.DD,'r.');
datetick('x');
set(gca,'TickDir','out');
hold on
plot(data2.time,data2.DD,'k.');
datetick('x');
set(gca,'TickDir','out','YLim',[0 360]);
ylabel('Wind direction / deg');
subplot(4,1,4);
plot(data1.time,data1.RH,'r-');
datetick('x');
set(gca,'TickDir','out');
hold on
plot(data2.time,data2.RH,'k-');
datetick('x');
set(gca,'TickDir','out');
ylabel('Relative humidity / %');

% save as figure in png format
print('-dpng','-r150',sprintf('AWS_%s-%s.png',datestr(dat1,'yyyymmdd'),datestr(dat2,'yyyymmdd')));

% fin

reading AWS data from raw logger files

clear

% Change to corresponding data directory 
cd('../../data/Incoming/')

% Get names of all files of interest
file='CR1000_1436_Minutt.dat';

% read data
data_all = importdata(file);
% Get the specific variables from file
data.P = data_all.data(:,1);   % Pressure                      [hPa]
data.TA = data_all.data(:,2);  % Temperature                   [deg C]
data.RH = data_all.data(:,3);  % Relative Humidity             [%]
data.WS = data_all.data(:,4);  % Wind Speed                    [m/s]
data.WD = data_all.data(:,5);  % Wind Direction                [deg]
data.RR = data_all.data(:,6);  % Rain Rate                     [mm]
data.GHI = data_all.data(:,7); % Global Horizontal Irradiation [W/m2]
% Get the timestamps
data.TIME = datenum(data_all.textdata(5:end,1),'yyyy-mm-dd HH:MM:SS');

tstart = datenum(2019,2,22,20,0,0);
tend   = datenum(2019,3,3,15,0,0);
% Plot Data of interest
figure(1)
subplot(2,1,1),plot(data.TIME,data.P)
datetick('x')
xlim([tstart,tend])
subplot(2,1,2),plot(data.TIME,data.TA)
ylim([-1,13])
datetick('x')
xlim([tstart,tend])