annotate extra/ncArray/inst/private/ncarray_example_file.m @ 10535:0f1fc56d9324 octave-forge

add license
author abarth93
date Tue, 03 Jul 2012 13:38:39 +0000
parents 03f260c80c1e
children b86d8743bf43
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10478
03f260c80c1e initial import of ncArray
abarth93
parents:
diff changeset
1 function ncarray_example_file(filename,data)
03f260c80c1e initial import of ncArray
abarth93
parents:
diff changeset
2
03f260c80c1e initial import of ncArray
abarth93
parents:
diff changeset
3 nc = netcdf(filename,'c');
03f260c80c1e initial import of ncArray
abarth93
parents:
diff changeset
4
03f260c80c1e initial import of ncArray
abarth93
parents:
diff changeset
5 % dimensions
03f260c80c1e initial import of ncArray
abarth93
parents:
diff changeset
6
03f260c80c1e initial import of ncArray
abarth93
parents:
diff changeset
7 nc('x') = size(data,1);
03f260c80c1e initial import of ncArray
abarth93
parents:
diff changeset
8 nc('y') = size(data,2);
03f260c80c1e initial import of ncArray
abarth93
parents:
diff changeset
9 nc('time') = size(data,3);
03f260c80c1e initial import of ncArray
abarth93
parents:
diff changeset
10
03f260c80c1e initial import of ncArray
abarth93
parents:
diff changeset
11 % variables
03f260c80c1e initial import of ncArray
abarth93
parents:
diff changeset
12
03f260c80c1e initial import of ncArray
abarth93
parents:
diff changeset
13 nc{'lon'} = ncfloat('y','x'); % 31680 elements
03f260c80c1e initial import of ncArray
abarth93
parents:
diff changeset
14 nc{'lon'}.long_name = ncchar('Longitude');
03f260c80c1e initial import of ncArray
abarth93
parents:
diff changeset
15 nc{'lon'}.units = ncchar('degrees_east');
03f260c80c1e initial import of ncArray
abarth93
parents:
diff changeset
16
03f260c80c1e initial import of ncArray
abarth93
parents:
diff changeset
17 nc{'lat'} = ncfloat('y','x'); % 31680 elements
03f260c80c1e initial import of ncArray
abarth93
parents:
diff changeset
18 nc{'lat'}.long_name = ncchar('Latitude');
03f260c80c1e initial import of ncArray
abarth93
parents:
diff changeset
19 nc{'lat'}.units = ncchar('degrees_north');
03f260c80c1e initial import of ncArray
abarth93
parents:
diff changeset
20
03f260c80c1e initial import of ncArray
abarth93
parents:
diff changeset
21 nc{'time'} = ncfloat('time'); % 1 elements
03f260c80c1e initial import of ncArray
abarth93
parents:
diff changeset
22 nc{'time'}.long_name = ncchar('Time');
03f260c80c1e initial import of ncArray
abarth93
parents:
diff changeset
23 nc{'time'}.units = ncchar('days since 1858-11-17 00:00:00 GMT');
03f260c80c1e initial import of ncArray
abarth93
parents:
diff changeset
24
03f260c80c1e initial import of ncArray
abarth93
parents:
diff changeset
25 nc{'SST'} = ncfloat('time','y','x'); % 31680 elements
03f260c80c1e initial import of ncArray
abarth93
parents:
diff changeset
26 nc{'SST'}.missing_value = ncfloat(9999);
03f260c80c1e initial import of ncArray
abarth93
parents:
diff changeset
27 nc{'SST'}.FillValue_ = ncfloat(9999);
03f260c80c1e initial import of ncArray
abarth93
parents:
diff changeset
28 nc{'SST'}.units = ncchar('degC');
03f260c80c1e initial import of ncArray
abarth93
parents:
diff changeset
29 nc{'SST'}.long_name = ncchar('Sea Surface Temperature');
03f260c80c1e initial import of ncArray
abarth93
parents:
diff changeset
30 nc{'SST'}.coordinates = ncchar('lat lon');
03f260c80c1e initial import of ncArray
abarth93
parents:
diff changeset
31
03f260c80c1e initial import of ncArray
abarth93
parents:
diff changeset
32 % global attributes
03f260c80c1e initial import of ncArray
abarth93
parents:
diff changeset
33
03f260c80c1e initial import of ncArray
abarth93
parents:
diff changeset
34 nc{'SST'}(:) = permute(data,[3 2 1]);
10535
0f1fc56d9324 add license
abarth93
parents: 10478
diff changeset
35 close(nc)
0f1fc56d9324 add license
abarth93
parents: 10478
diff changeset
36
0f1fc56d9324 add license
abarth93
parents: 10478
diff changeset
37
0f1fc56d9324 add license
abarth93
parents: 10478
diff changeset
38 % Copyright (C) 2012 Alexander Barth <barth.alexander@gmail.com>
0f1fc56d9324 add license
abarth93
parents: 10478
diff changeset
39 %
0f1fc56d9324 add license
abarth93
parents: 10478
diff changeset
40 % This program is free software; you can redistribute it and/or modify
0f1fc56d9324 add license
abarth93
parents: 10478
diff changeset
41 % it under the terms of the GNU General Public License as published by
0f1fc56d9324 add license
abarth93
parents: 10478
diff changeset
42 % the Free Software Foundation; either version 2 of the License, or
0f1fc56d9324 add license
abarth93
parents: 10478
diff changeset
43 % (at your option) any later version.
0f1fc56d9324 add license
abarth93
parents: 10478
diff changeset
44 %
0f1fc56d9324 add license
abarth93
parents: 10478
diff changeset
45 % This program is distributed in the hope that it will be useful,
0f1fc56d9324 add license
abarth93
parents: 10478
diff changeset
46 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0f1fc56d9324 add license
abarth93
parents: 10478
diff changeset
47 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0f1fc56d9324 add license
abarth93
parents: 10478
diff changeset
48 % GNU General Public License for more details.
0f1fc56d9324 add license
abarth93
parents: 10478
diff changeset
49 %
0f1fc56d9324 add license
abarth93
parents: 10478
diff changeset
50 % You should have received a copy of the GNU General Public License
0f1fc56d9324 add license
abarth93
parents: 10478
diff changeset
51 % along with this program; If not, see <http://www.gnu.org/licenses/>.
0f1fc56d9324 add license
abarth93
parents: 10478
diff changeset
52