Here you are -- code below works out dates when there were TCs or TSs within 500 km of the Island of Socotra
Simon
-------------------
def gc_distance(lat1, long1, lat2, long2,earth_radius=None):
"""
Compute great circle distance between a two sets of points on the Earth (or any other near-spherical object)
from https://www.johndcook.com/blog/python_longitude_latitude/ and converted to use numpy.
:param lat1: first latitude -- a float or a numpy array. Should be in degrees
:param long1: first longitude -- a float or a numpy array. Should be in degrees
:param lat2: second latitude -- a float or a numpy array. Should be in degrees
:param long2: second longitude -- a float or a numpy array. Should be in degrees
:param earth_radius: raidus of Earth in m. Default is None which uses 6371 km.
Distance is computed between (lat1,long1) & (lat2,long2). If using numpy broadcasting should handle sizes sensibly...
"""
if earth_radius is None:
radius = 6371e3 # mean radius of the earth for WGS74 -- see https://en.wikipedia.org/wiki/World_Geodetic_System
else:
radius = earth_radius
degrees_to_radians = np.pi/180.0
# phi = 90 - latitude
phi1 = (90.0 - lat1)*degrees_to_radians
phi2 = (90.0 - lat2)*degrees_to_radians
# theta = longitude
theta1 = long1*degrees_to_radians
theta2 = long2*degrees_to_radians
# Compute spherical distance from spherical coordinates.
# For two locations in spherical coordinates
# (1, theta, phi) and (1, theta', phi')
# cosine( arc length ) = sin phi sin phi' cos(theta-theta') + cos phi cos phi'
# distance = rho * arc length
cos = (np.sin(phi1)*np.sin(phi2)*np.cos(theta1 - theta2) +
np.cos(phi1)*np.cos(phi2))
arc = np.arccos( cos )
return arc*radius # convert from radians to m
# get in the hurricane track info.
tc_ni = pd.read_csv('data/ibtracs.NI.list.v04r00.csv',header=0,index_col=['SID','ISO_TIME'],skiprows=[1],
parse_dates=['ISO_TIME'],cache_dates=True,skipinitialspace=True)
# read the North Indian IBTrACS (version 4 data) -- got from#:
# https://www.ncdc.noaa.gov/ibtracs/index.php..
# find cyclones "near" Socotra
near_dist = 500e3 # within 500 km.
gc = gc_distance(tc_ni.LAT,tc_ni.LON,
socrotaLib.socrota_centre['latitude'],socrotaLib.socrota_centre['longitude'])
near_soc = (gc < near_dist) & (tc_ni.USA_SSHS >= 0) # an actual cyclone or tropical storm.
cyclone_dates = np.unique(near_soc[near_soc].index.get_level_values('ISO_TIME').normalize())