Newer
Older
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
ncFile='./raw_input_data/{{cookiecutter.input_fname}}';
fldName='{{cookiecutter.input_varname}}';
ncid=netcdf.open(ncFile,'nowrite');
fld_id= netcdf.inqVarID(ncid,fldName);
lon_id= netcdf.inqVarID(ncid,'lon');
lat_id= netcdf.inqVarID(ncid,'lat');
fld=netcdf.getVar(ncid,fld_id);
fld=fld';
lon=netcdf.getVar(ncid,lon_id);
lat=netcdf.getVar(ncid,lat_id);
%lon=-180:1/60:180; lon=lon';
%lat=-90:1/60:90; lat=lat';
if min(size(lon))==2
lon=lon(1,:);
lat=lat(2,:);
end
netcdf.close(ncid)
imagesc(lon,lat,fld)
set(gca,'ydir','normal')
[C h]=contour(lon,lat,fld,[0. 0.]);
%cst=C';
%for i=1:size(cst,1)
% if cst(i,1)==0
% ofs=cst(i,2);
% cst(i,:)=cst(i+ofs,:);
% end
%end
cst=C';
CST=[];
for i=1:size(cst,1)
if cst(i,1)==0 & cst(i,2)>180
ofs=cst(i,2)
CST=[CST; cst(i+1:i+ofs,:)];
end
end
save -ascii {{cookiecutter.mesh_name}}_cst.txt CST
exit;