POS_GF0906 - the positions to gf0906

Author: Torsten Linders

Date: 7 June 2010

Contents

Preparations

Cleaning up

clear
close all
fclose('all');

Allocations

lastf=1236;
lat_=zeros(lastf,1);
lon_=zeros(lastf,1);
dist_=zeros(lastf,1);
depth_=zeros(lastf,3);

Data files

The array i_ contain the indices of the casts with data files.

dir='C:\Users\torsten\Gf0906\MSS\epsi_5dm_torsten\';
i_=[3:29 31:100 102:106 155:161 163:257 259:413 418:lastf];
for i=i_
    if i<10
        filename=[dir 'epsi000' num2str(i) '.tob'];
    elseif i<100
        filename=[dir 'epsi00' num2str(i) '.tob'];
    elseif i<1000
        filename=[dir 'epsi0' num2str(i) '.tob'];
    else
        filename=[dir 'epsi' num2str(i) '.tob'];
    end
    fid=fopen(filename);

Text scanning

First we scan to the line where the positions are found.

    row1_9=textscan(fid,'%640c',1);
    row10=textscan(fid,'%50c',1);
    fclose(fid);
    row10=cell2mat(row10);

Then we scan to find the longitude and latitude.

    if i<352
        hour=textscan(row10(7:end),'%f');
        hour=cell2mat(hour);
        if hour<10
            lat=textscan(row10(18:end),'%f');
            lon=textscan(row10(30:end),'%f');
        else
            lat=textscan(row10(18:end),'%f');
            lon=textscan(row10(30:end),'%f');
        end
        lat=cell2mat(lat);
        lon=cell2mat(lon);
    else
        hour=textscan(row10(18:end),'%f');
        hour=cell2mat(hour);
        if hour<10
            lat=textscan(row10(28:end),'%f');
            lon=textscan(row10(39:end),'%f');
        else
            lat=textscan(row10(28:end),'%f');
            lon=textscan(row10(39:end),'%f');
        end
        lat=cell2mat(lat);
        lon=cell2mat(lon);

        lat_int=floor(lat);
        lat_deg=floor(lat_int/100);
        lat_dec1=(lat_int/100-lat_deg);
        lat_dec2=lat-lat_int;
        lat=lat_deg+lat_dec1*10/6+lat_dec2/100*10/6;

        lon_int=floor(lon);
        lon_deg=floor(lon_int/100);
        lon_dec1=(lon_int/100-lon_deg);
        lon_dec2=lon-lon_int;
        lon=lon_deg+lon_dec1*10/6+lon_dec2/100*10/6;
    end
    lat_(i)=lat;
    lon_(i)=lon;
end

Manual positions

The array j_ contains the indices of the casts where the file header has no position and the positions therefore are taken from the array pos_man. In most of these cases the positions are availiable in the cruise log book, taken from an external GPS. In a few cases interpolations between availiable positions have made. The manually inserted positions are given in pos_gf0906_man.

j_=[101 107:154 162];
pos_gf0906_man
for i=j_
    lat_(i)=pos_man(i,1);
    lon_(i)=pos_man(i,2);
end

Distance and depth

The horizontal distance, from the reference position, along the transect across the sillis found by calling the function distdepth_gf0906. The same function also gives the depths (of three parrallell transects)

for i=1:lastf
    [dist_c(i),depth_c(i,:)]=distdepth_gf0906(lon_(i));
end

Saving

save latlon lat_ lon_ dist_c depth_c

Plotting

Blue dots are positions from the data file headers. Red dots are manually filled positions.

fig=figure(2000);
set(fig,'Position',[1 1 900 900]);

subplot(2,2,1)
plot(i_,lat_(i_),'.',...
    j_,lat_(j_),'.r')
xlabel('Cast number')
ylabel('Latitude (^oN)')
grid on

subplot(2,2,4)
plot(lon_(i_),i_,'.',...
    lon_(j_),j_,'.r')
xlabel('Longitude (^oE)')
ylabel('Cast number')
grid on

subplot(2,2,2)
plot(lon_(i_),lat_(i_),'.',...
    lon_(j_),lat_(j_),'.r')
xlabel('Longitude (^oE)')
ylabel('Latitude (^oN)')
grid on

subplot(2,2,3)
plot(dist_c(i_)/1000,i_,'.',...
    dist_c(j_)/1000,j_,'.r')
xlabel('Along track horizontal distance (km)')
ylabel('Cast number')
grid on