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;