%
% This function retrieves the number of the particular TC ranked by
% intensity within circle, at intersection of line segments in polyfile, or
% at peak intensity.
%
% Copyright WindRiskTech, LLC  2026
%--------------------------------------------------------------------------
function [nt] = get_storm_num()
%
load temp shape city_radius
load sorted nsort nsortp
prompt = {'Order by maximum at POI (1), maximum near POI (2), lifetime maximum (3), or by track number (4)?', ...
        'Track number'};
dlg_title = 'Track Parameters';
num_lines = 1;
answer = inputdlg(prompt,dlg_title,num_lines);
if isempty(answer) || isempty(answer{1})
    return
end    
nswitch=str2double(answer{1});
if (strcmp(shape,'poly') || city_radius >= 2000) && nswitch == 1
    warndlg('Warning: Winds at POI not meaningful for this set; ordering by maximum near POI')
    nswitch=2;
end        
nttemp=str2double(answer{2});
%
if nswitch == 1
   nt=nsortc(nttemp);
elseif nswitch == 2
   nt=nsortp(nttemp);
elseif nswitch == 3   
   nt=nsort(nttemp);
else
   nt=nttemp;
end   
%
end