-
Notifications
You must be signed in to change notification settings - Fork 9
/
URBANGET
executable file
·79 lines (56 loc) · 1.55 KB
/
URBANGET
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
function urbanget
% urbanget: get .mat files of urban heat island adjusted hcn monthly tmp
% CALL: urbanget
%
% Meko 6-11-97
%
%
%********************* IN ******************************
%
% User is prompted for filenames of the station list
% (typically stnlist.txt) and the main data file (urban.mea)
%
%********************* OUT *****************************
%
% Individual .mat files are produced for each station in
% stnlist.txt.
%
%
%************************* NOTES ********************
%
% See howto\hcntget1.txt for description of the stnlist.txt and
% urban.mea files.
% Allow for max of 1500 files
bb=blanks(5);
CN = repmat(bb,1500,1); % will hold names
ID = zeros(1500,1); % will hold station ids
% Open station list file
[file1,path1]=uigetfile('stnl*.txt','Station list file');
pf1=[path1 file1];
fid1=fopen(pf1,'r');
% Load data file
[file2,path2]=uigetfile('urban.mea','Input data file');
pf2=[path2 file2];
eval(['load ' pf2]); % data will be in matrix 'urban'
% Find out how many stations to get, store their ids and output file names
k1=1;
nfiles=0;
while k1;
c=fgetl(fid1);
if ~feof(fid1) & length(c)>50;
nfiles=nfiles+1;
% Output file name begins after first whitespace
i1 = find(isspace(c))+1;
i1=i1(1);
CN(nfiles,:)=c(i1:(i1+4)); % store first part of output file name
ID(nfiles)=str2num(c(1:6));
end
end
fclose(fid1);
% Get data for each station
for n = 1:nfiles;
L=urban(:,1)==ID(n);
Z = urban(:,2:14);
eval(['save ' CN(n,:) ' Z']);
end