-
Notifications
You must be signed in to change notification settings - Fork 3
/
ibtracs.m
40 lines (35 loc) · 996 Bytes
/
ibtracs.m
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
function [lon,lat]=ibtracs(code)
% [lon,lat]=IBTRACS(code)
%
% Downloads hurricane (track etc) data from NOAA
%
% INPUT:
%
% code A hurricane code, e.g. '1984025S14073'
%
% OUTPUT:
%
% lon lat Matrices of dimensions [M x nlon] or [M x nlat]
% because there may be M solutions for lon and lat
%
% EXAMPLE:
%
% lonlat=ibtracs('1984025S14073');
%
% Last modified by fjsimons-at-alum.mit.edu, 10/02/2017
% Specify where to get it
servername='ftp://eclipse.ncdc.noaa.gov';
directoryn='/pub/ibtracs/v03r04/ibtracs/';
extensionn='.ibtracs.v03r04.nc';
% This will also be our local filename
filename=sprintf('%s%s',code,extensionn);
% Neither WEBSAVE nor MGET work; CURL could substitute
if exist(filename,'file')~=2
system(sprintf('wget %s',fullfile(servername,directoryn,filename)));
end
% Load the variables
lon=ncread(filename,'lon_from_source');
lat=ncread(filename,'lat_from_source');
% Remove the -999 which clearly aren't any good
lon(lon==-999)=NaN;
lat(lat==-999)=NaN;