function [xs_xs_ids, xs_rcl_ids, obs_xs_ids, obs_rcl_ids] = ....
    xs_obs_id_extract(his_fnameloc)

%% Collect cross-section labels

xs_xsids_raw = ncread(his_fnameloc,'cross_section_name');
xs_xsids_clipped = strcat(xs_xsids_raw(2:end,:)');
xs_num = numel(xs_xsids_clipped(:,1));

% Extract cross-section (xs) and right fp, channel, or left fp (rcl)
% observation point ids into numerical arrays

xs_xs_ids = zeros(xs_num,1);
xs_rcl_ids = zeros(xs_num,1);
xs_i = 0;
for i = 3:3:xs_num
    
    xs_i = xs_i + 1;
    
    xs_xs_ids(i-2,1) = xs_i;
    xs_rcl_ids(i-2,1) = 1;

    xs_xs_ids(i-1,1) = xs_i;
    xs_rcl_ids(i-1,1) = 2;

    xs_xs_ids(i,1) = xs_i;
    xs_rcl_ids(i,1) = 3;
    
end

%% Collect observation point labels

obs_xsids_raw = ncread(his_fnameloc,'station_id');
obs_xsids_clipped = strcat(obs_xsids_raw(3:end,:)');
obs_num = numel(obs_xsids_clipped(:,1));

% Extract cross-section (xs) and right fp, channel, or left fp (rcl)
% observation point ids into numerical arrays
xsid_length = zeros(obs_num,1);
obs_xs_ids = zeros(obs_num,1);
obs_rcl_ids = zeros(obs_num,1);
for i = 1:obs_num
    xsid_length(i,1) = length(strtrim(obs_xsids_clipped(i,:)));
    if xsid_length(i,1) == 2
        obs_xs_ids(i,1) = str2num(obs_xsids_clipped(i,1));
        obs_rcl_ids(i,1) = str2num(obs_xsids_clipped(i,2));
    elseif xsid_length(i,1) == 3
        obs_xs_ids(i,1) = str2num(obs_xsids_clipped(i,1:2));
        obs_rcl_ids(i,1) = str2num(obs_xsids_clipped(i,3));
    elseif xsid_length(i,1) == 4
        obs_xs_ids(i,1) = str2num(obs_xsids_clipped(i,1:3));
        obs_rcl_ids(i,1) = str2num(obs_xsids_clipped(i,4));
    end
end

