Advertisement
Guest User

sdagsdfsd

a guest
Feb 26th, 2013
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 36.18 KB | None | 0 0
  1. pywx v2.0.1
  2.  
  3. I removed the IRC functions because I would prefer not to have 15 pywx's...
  4.  
  5. Also it doesn't create all the files it needs and I'm not sure how to do that... And you'll need to recode it to just work in the cmd (which is how version 1 worked on my comp)
  6.  
  7. [code]
  8. def ping(): # This is our first function! It will respond to server Pings.
  9.  ircsock.send("PONG :pingis\n")  
  10.  wx()
  11.  
  12. def findnth(haystack, needle, n):
  13.    parts= haystack.split(needle, n+1)
  14.    if len(parts)<=n+1:
  15.        return -1
  16.    return len(haystack)-len(parts[-1])-len(needle)
  17.  
  18. def sendmsg(chan , msg): # This is the send message function, it simply sends messages to the channel.
  19.  ircsock.send("PRIVMSG "+ chan +" :"+ msg +"\n")
  20.  
  21. def joinchan(chan): # This function is used to join channels.
  22.  ircsock.send("JOIN "+ chan +"\n")
  23.  
  24. def hello(): # This function responds to a user that inputs "Hello Mybot"
  25.  ircsock.send("PRIVMSG "+ channel +" :Hello!\n")
  26.  
  27. def grand():
  28.  i = int(random.random()*2)
  29.  j = int(random.random()*2)
  30.  k = a[i] + b[j]
  31.  ircsock.send("PRIVMSG "+ channel +" : Your generated string is\:"+ k +"\n")
  32.  
  33. def wx():
  34. s1 = wptq20()
  35. s4 = wtnt21()
  36. s5 = wtnt22()
  37. s6 = wtnt23()
  38. s7 = wtnt24()
  39. s8 = wtnt25()
  40. s9 = wtin20()
  41. s10 = wwjp25()
  42. s11 = wtio30()
  43. s12 = wtpz21()
  44. s13 = wtpz22()
  45. s14 = wtpz23()
  46. s15 = wtpz24()
  47. s16 = wtpz25()
  48. s17 = wwps21()
  49. s18 = wtps11()
  50. s19 = axau01()
  51. s20 = axau02()
  52. #s21 = axau03()
  53. s22 = axau01_adrm()
  54. s23 = axau21()
  55. if s1:
  56. ircsock.send("PRIVMSG "+ channel +" :"+ s1 +"\n")
  57. if s4:
  58. ircsock.send("PRIVMSG "+ channel +" :"+ s4 +"\n")
  59. if s5:
  60. ircsock.send("PRIVMSG "+ channel +" :"+ s5 +"\n")
  61. if s6:
  62. ircsock.send("PRIVMSG "+ channel +" :"+ s6 +"\n")
  63. if s7:
  64. ircsock.send("PRIVMSG "+ channel +" :"+ s7 +"\n")
  65. if s8:
  66. ircsock.send("PRIVMSG "+ channel +" :"+ s8 +"\n")
  67. if s9:
  68. ircsock.send("PRIVMSG "+ channel +" :"+ s9 +"\n")
  69. if s10:
  70. ircsock.send("PRIVMSG "+ channel +" :"+ s10 +"\n")
  71. if s11:
  72. ircsock.send("PRIVMSG "+ channel +" :"+ s11 +"\n")
  73. if s12:
  74. ircsock.send("PRIVMSG "+ channel +" :"+ s12 +"\n")
  75. if s13:
  76. ircsock.send("PRIVMSG "+ channel +" :"+ s13 +"\n")
  77. if s14:
  78. ircsock.send("PRIVMSG "+ channel +" :"+ s14 +"\n")
  79. if s15:
  80. ircsock.send("PRIVMSG "+ channel +" :"+ s15 +"\n")
  81. if s16:
  82. ircsock.send("PRIVMSG "+ channel +" :"+ s16 +"\n")
  83. if s17:
  84. ircsock.send("PRIVMSG "+ channel +" :"+ s17 +"\n")
  85. if s18:
  86. ircsock.send("PRIVMSG "+ channel +" :"+ s18 +"\n")
  87. if s19:
  88. ircsock.send("PRIVMSG "+ channel +" :"+ s19 +"\n")
  89. if s20:
  90. ircsock.send("PRIVMSG "+ channel +" :"+ s20 +"\n")
  91. #if s21:
  92. # ircsock.send("PRIVMSG "+ channel +" :"+ s21 +"\n")
  93. if s22:
  94. ircsock.send("PRIVMSG "+ channel +" :"+ s22 +"\n")
  95. if s23:
  96. ircsock.send("PRIVMSG "+ channel +" :"+ s23 +"\n")
  97. else:
  98. pass
  99.  
  100. def wwjp25():
  101. file = urllib2.urlopen("http://weather.noaa.gov/pub/data/raw/ww/wwjp25.rjtd..txt")
  102. output = open('wwjp25_1.txt','w+b')
  103. output.write(file.read())
  104. output.seek(0)
  105. header = output.read(6)
  106. output.seek(12)
  107. newproducttime = output.read(6)
  108. output.close()
  109. output = open('wwjp25.txt','rb')
  110. output.seek(12)
  111. producttime = output.read(6)
  112. output.close()
  113. if newproducttime != producttime:
  114. output = open('wwjp25.txt','w+b')
  115. copy = open('wwjp25_1.txt','rb')
  116. output.write(copy.read())
  117. output.close()
  118. copy.seek(0)
  119. line_offset = []
  120. offset = 0
  121. for line in copy:
  122. line_offset.append(offset)
  123. offset += len(line)
  124. copy.seek(0)
  125. test = copy.read()
  126. if test.find("TROPICAL DEPRESSION") != -1:
  127. index = test.find("TROPICAL DEPRESSION")
  128. copy.seek(index)
  129. name = copy.readline()
  130. name = name.strip('\n')
  131. index = test.find("HPA AT")
  132. if index != -1:
  133. update = "WWJP25 %s" % (name)
  134. copy.close()
  135. return update
  136.  
  137. def wptq20():
  138. file = urllib2.urlopen("http://weather.noaa.gov/pub/data/raw/wt/wtpq20.rjtd..txt")
  139. output = open('wtpq20_1.txt','w+b')
  140. output.write(file.read())
  141. output.seek(0)
  142. header = output.read(6)
  143. output.seek(12)
  144. newproducttime = output.read(6)
  145. output.close()
  146. output = open('wtpq20.txt','rb')
  147. output.seek(12)
  148. producttime = output.read(6)
  149. output.close()
  150. if newproducttime != producttime:
  151. output = open('wtpq20.txt','w+b')
  152. copy = open('wtpq20_1.txt','rb')
  153. output.write(copy.read())
  154. output.close()
  155. copy.seek(0)
  156. #Read in the file once and build a list of line offsets
  157. line_offset = []
  158. offset = 0
  159. for line in copy:
  160. line_offset.append(offset)
  161. offset += len(line)
  162. copy.seek(line_offset[2]+6)
  163. name = copy.readline()
  164. name = name.strip('\n')
  165. copy.seek(line_offset[4]+16)
  166. location = copy.readline()
  167. location = location.strip('\n')
  168. copy.seek(line_offset[5]+6)
  169. dir = copy.readline()
  170. dir = dir.strip('\n')
  171. copy.seek(line_offset[6]+6)
  172. pres = copy.readline()
  173. pres = pres.strip('\n')
  174. copy.seek(line_offset[7]+6)
  175. wind = copy.readline()
  176. wind = wind.strip('\n')
  177. update = "WTPQ20 %s %s %s %s %s" % (name, location, dir, pres, wind)
  178. copy.close()
  179. return update
  180.  
  181. def wtnt21():
  182. file = urllib2.urlopen("http://weather.noaa.gov/pub/data/raw/wt/wtnt21.knhc.tcm.at1.txt")
  183. output = open('wtnt21_1.txt','w+b')
  184. output.write(file.read())
  185. output.seek(0)
  186. header = output.read(6)
  187. output.seek(12)
  188. newproducttime = output.read(6)
  189. output.close()
  190. output = open('wtnt21.txt','rb')
  191. output.seek(12)
  192. producttime = output.read(6)
  193. output.close()
  194. if newproducttime != producttime:
  195. output = open('wtnt21.txt','w+b')
  196. copy = open('wtnt21_1.txt','rb')
  197. output.write(copy.read())
  198. #output.close()
  199. copy.seek(0)
  200. line_offset = []
  201. offset = 0
  202. for line in copy:
  203. line_offset.append(offset)
  204. offset += len(line)
  205. copy.seek(0)
  206. test = copy.read()
  207. index = test.find(" AL")
  208. copy.seek(index+1)
  209. name = copy.readline()
  210. name = name.strip('\n')
  211. index = test.find("NEAR")
  212. copy.seek(index+5)
  213. location = copy.readline()
  214. location = location.strip('\n')
  215. index = test.find("MOVEMENT")
  216. copy.seek(index+9)
  217. dir = copy.readline()
  218. dir = dir.strip('\n')
  219. index = test.find("PRESSURE")
  220. copy.seek(index+9)
  221. pres = copy.readline()
  222. pres = pres.strip('\n')
  223. index = test.find("WINDS")
  224. copy.seek(index+5)
  225. wind = copy.read(7)
  226. wind = wind.strip('\n')
  227. update = "WTNT21 %s %s %s %s %s" % (name, location, dir, pres, wind)
  228. copy.close()
  229. return update
  230.  
  231. def wtnt22():
  232. file = urllib2.urlopen("http://weather.noaa.gov/pub/data/raw/wt/wtnt22.knhc.tcm.at2.txt")
  233. output = open('wtnt22_1.txt','w+b')
  234. output.write(file.read())
  235. output.seek(0)
  236. header = output.read(6)
  237. output.seek(12)
  238. newproducttime = output.read(6)
  239. output.close()
  240. output = open('wtnt22.txt','rb')
  241. output.seek(12)
  242. producttime = output.read(6)
  243. output.close()
  244. if newproducttime != producttime:
  245. output = open('wtnt22.txt','w+b')
  246. copy = open('wtnt22_1.txt','rb')
  247. output.write(copy.read())
  248. #output.close()
  249. copy.seek(0)
  250. line_offset = []
  251. offset = 0
  252. for line in copy:
  253. line_offset.append(offset)
  254. offset += len(line)
  255. copy.seek(0)
  256. test = copy.read()
  257. index = test.find(" AL")
  258. copy.seek(index+1)
  259. name = copy.readline()
  260. name = name.strip('\n')
  261. index = test.find("NEAR")
  262. copy.seek(index+5)
  263. location = copy.readline()
  264. location = location.strip('\n')
  265. index = test.find("MOVEMENT")
  266. copy.seek(index+9)
  267. dir = copy.readline()
  268. dir = dir.strip('\n')
  269. index = test.find("PRESSURE")
  270. copy.seek(index+9)
  271. pres = copy.readline()
  272. pres = pres.strip('\n')
  273. index = test.find("WINDS")
  274. copy.seek(index+5)
  275. wind = copy.read(7)
  276. wind = wind.strip('\n')
  277. update = "WTNT22 %s %s %s %s %s" % (name, location, dir, pres, wind)
  278. copy.close()
  279. return update
  280.  
  281. def wtnt23():
  282. file = urllib2.urlopen("http://weather.noaa.gov/pub/data/raw/wt/wtnt23.knhc.tcm.at3.txt")
  283. output = open('wtnt23_1.txt','w+b')
  284. output.write(file.read())
  285. output.seek(0)
  286. header = output.read(6)
  287. output.seek(12)
  288. newproducttime = output.read(6)
  289. output.close()
  290. output = open('wtnt23.txt','rb')
  291. output.seek(12)
  292. producttime = output.read(6)
  293. output.close()
  294. if newproducttime != producttime:
  295. output = open('wtnt23.txt','w+b')
  296. copy = open('wtnt23_1.txt','rb')
  297. output.write(copy.read())
  298. #output.close()
  299. copy.seek(0)
  300. line_offset = []
  301. offset = 0
  302. for line in copy:
  303. line_offset.append(offset)
  304. offset += len(line)
  305. copy.seek(0)
  306. test = copy.read()
  307. index = test.find(" AL")
  308. copy.seek(index+1)
  309. name = copy.readline()
  310. name = name.strip('\n')
  311. index = test.find("NEAR")
  312. copy.seek(index+5)
  313. location = copy.readline()
  314. location = location.strip('\n')
  315. index = test.find("MOVEMENT")
  316. copy.seek(index+9)
  317. dir = copy.readline()
  318. dir = dir.strip('\n')
  319. index = test.find("PRESSURE")
  320. copy.seek(index+9)
  321. pres = copy.readline()
  322. pres = pres.strip('\n')
  323. index = test.find("WINDS")
  324. copy.seek(index+5)
  325. wind = copy.read(7)
  326. wind = wind.strip('\n')
  327. update = "WTNT23 %s %s %s %s %s" % (name, location, dir, pres, wind)
  328. copy.close()
  329. return update
  330.  
  331. def wtnt24():
  332. file = urllib2.urlopen("http://weather.noaa.gov/pub/data/raw/wt/wtnt24.knhc.tcm.at4.txt")
  333. output = open('wtnt24_1.txt','w+b')
  334. output.write(file.read())
  335. output.seek(0)
  336. header = output.read(6)
  337. output.seek(12)
  338. newproducttime = output.read(6)
  339. output.close()
  340. output = open('wtnt24.txt','rb')
  341. output.seek(12)
  342. producttime = output.read(6)
  343. output.close()
  344. if newproducttime != producttime:
  345. output = open('wtnt24.txt','w+b')
  346. copy = open('wtnt24_1.txt','rb')
  347. output.write(copy.read())
  348. #output.close()
  349. copy.seek(0)
  350. line_offset = []
  351. offset = 0
  352. for line in copy:
  353. line_offset.append(offset)
  354. offset += len(line)
  355. copy.seek(0)
  356. test = copy.read()
  357. index = test.find(" AL")
  358. copy.seek(index+1)
  359. name = copy.readline()
  360. name = name.strip('\n')
  361. index = test.find("NEAR")
  362. copy.seek(index+5)
  363. location = copy.readline()
  364. location = location.strip('\n')
  365. index = test.find("MOVEMENT")
  366. copy.seek(index+9)
  367. dir = copy.readline()
  368. dir = dir.strip('\n')
  369. index = test.find("PRESSURE")
  370. copy.seek(index+9)
  371. pres = copy.readline()
  372. pres = pres.strip('\n')
  373. index = test.find("WINDS")
  374. copy.seek(index+5)
  375. wind = copy.read(7)
  376. wind = wind.strip('\n')
  377. update = "WTNT24 %s %s %s %s %s" % (name, location, dir, pres, wind)
  378. copy.close()
  379. return update
  380.  
  381. def wtnt25():
  382. file = urllib2.urlopen("http://weather.noaa.gov/pub/data/raw/wt/wtnt25.knhc.tcm.at5.txt")
  383. output = open('wtnt25_1.txt','w+b')
  384. output.write(file.read())
  385. output.seek(0)
  386. header = output.read(6)
  387. output.seek(12)
  388. newproducttime = output.read(6)
  389. output.close()
  390. output = open('wtnt25.txt','rb')
  391. output.seek(12)
  392. producttime = output.read(6)
  393. output.close()
  394. if newproducttime != producttime:
  395. output = open('wtnt25.txt','w+b')
  396. copy = open('wtnt25_1.txt','rb')
  397. output.write(copy.read())
  398. #output.close()
  399. copy.seek(0)
  400. line_offset = []
  401. offset = 0
  402. for line in copy:
  403. line_offset.append(offset)
  404. offset += len(line)
  405. copy.seek(0)
  406. test = copy.read()
  407. index = test.find(" AL")
  408. copy.seek(index+1)
  409. name = copy.readline()
  410. name = name.strip('\n')
  411. index = test.find("NEAR")
  412. copy.seek(index+5)
  413. location = copy.readline()
  414. location = location.strip('\n')
  415. index = test.find("MOVEMENT")
  416. copy.seek(index+9)
  417. dir = copy.readline()
  418. dir = dir.strip('\n')
  419. index = test.find("PRESSURE")
  420. copy.seek(index+9)
  421. pres = copy.readline()
  422. pres = pres.strip('\n')
  423. index = test.find("WINDS")
  424. copy.seek(index+5)
  425. wind = copy.read(7)
  426. wind = wind.strip('\n')
  427. update = "WTNT25 %s %s %s %s %s" % (name, location, dir, pres, wind)
  428. copy.close()
  429. return update
  430.  
  431. def wtin20():
  432. file = urllib2.urlopen("http://weather.noaa.gov/pub/data/raw/wt/wtin20.dems..txt")
  433. output = open('wtin20_1.txt','w+b')
  434. output.write(file.read())
  435. output.seek(0)
  436. header = output.read(6)
  437. output.seek(12)
  438. newproducttime = output.read(6)
  439. output.close()
  440. output = open('wtin20.txt','rb')
  441. output.seek(12)
  442. producttime = output.read(6)
  443. output.close()
  444. if newproducttime != producttime:
  445. output = open('wtin20.txt','w+b')
  446. copy = open('wtin20_1.txt','rb')
  447. output.write(copy.read())
  448. #output.close()
  449. copy.seek(0)
  450. line_offset = []
  451. offset = 0
  452. for line in copy:
  453. line_offset.append(offset)
  454. offset += len(line)
  455. copy.seek(0)
  456. test = copy.read()
  457. if test.find(" STORM") != -1:
  458. index = test.find(" STORM")
  459. copy.seek(index+6)
  460. name = copy.readline()
  461. name = name.strip('\n')
  462. index = test.find("LATITUDE")
  463. copy.seek(index)
  464. location = copy.read(37)
  465. location = location.strip('\n')
  466. #index = test.find("MOVEMENT")
  467. #copy.seek(index+9)
  468. #dir = copy.readline()
  469. #dir = dir.strip('\n')
  470. #index = test.find("PRESSURE")
  471. #copy.seek(index+9)
  472. #pres = copy.readline()
  473. #pres = pres.strip('\n')
  474. index = test.find("(KMPH)")
  475. copy.seek(index+41)
  476. wind1 = copy.read(3)
  477. wind1 = int(wind1.strip('-'))
  478. copy.seek(index+44)
  479. wind2 = copy.read(3)
  480. wind2 = int(wind2.strip(' '))
  481. wind = (wind1 + wind2) / 2
  482. update = "WTIN20 %s %s %s km/h" % (name, location, wind)
  483. copy.close()
  484. return update
  485.  
  486. def wtio30():
  487. file = urllib2.urlopen("http://weather.noaa.gov/pub/data/raw/wt/wtio30.fmee..txt")
  488. output = open('wtio30_1.txt','w+b')
  489. output.write(file.read())
  490. output.seek(0)
  491. header = output.read(6)
  492. output.seek(12)
  493. newproducttime = output.read(6)
  494. output.close()
  495. output = open('wtio30.txt','rb')
  496. output.seek(12)
  497. producttime = output.read(6)
  498. output.close()
  499. if newproducttime != producttime:
  500. output = open('wtio30.txt','w+b')
  501. copy = open('wtio30_1.txt','rb')
  502. output.write(copy.read())
  503. output.close()
  504. copy.seek(0)
  505. #Read in the file once and build a list of line offsets
  506. copy.seek(0)
  507. test = copy.read()
  508. index = test.find("1.A")
  509. #
  510. copy.seek(index)
  511. nameline = copy.readline()
  512. if nameline.find("TROPICAL STORM") != -1:
  513. tmpind = index + nameline.find("TROPICAL STORM") + len("TROPICAL STORM")
  514. copy.seek(tmpind+1)
  515. tmpcode = copy.read(2)
  516. elif nameline.find("TROPICAL CYCLONE") != -1:
  517. tmpind = index + nameline.find("TROPICAL CYCLONE") + len("TROPICAL CYCLONE")
  518. copy.seek(tmpind+1)
  519. tmpcode = copy.read(2)
  520. elif nameline.find("TROPICAL DEPRESSION") != -1:
  521. tmpind = index + nameline.find("TROPICAL DEPRESSION") + len("TROPICAL DEPRESSION")
  522. copy.seek(tmpind+1)
  523. tmpcode = copy.read(2)
  524. elif nameline.find("OVERLAND DEPRESSION") != -1:
  525. tmpind = index + nameline.find("OVERLAND DEPRESSION") + len("OVERLAND DEPRESSION")
  526. copy.seek(tmpind+1)
  527. tmpcode = copy.read(2)
  528. elif nameline.find("TROPICAL DISTURBANCE") != -1:
  529. tmpind = index + nameline.find("TROPICAL DISTURBANCE") + len("TROPICAL DISTURBANCE")
  530. copy.seek(tmpind+1)
  531. tmpcode = copy.read(2)
  532. copy.seek(index+4)
  533. name = copy.readline()
  534. name = name.strip('\n')
  535. index = test.find("WITHIN")
  536. copy.seek(index)
  537. location = copy.readline()
  538. location = location.strip('\n')
  539. index = test.find("MOVEMENT")
  540. copy.seek(index+11)
  541. dir = copy.readline()
  542. dir = dir.strip('\n')
  543. index = test.find("5.A")
  544. copy.seek(index+35)
  545. pres = copy.readline()
  546. pres = pres.strip('\n')
  547. index = test.find("4.A")
  548. copy.seek(index+21)
  549. wind = copy.readline()
  550. wind = wind.strip('\n')
  551. update = "WTIO30 %s %s %s %s %s" % (name, location, dir, pres, wind)
  552. #
  553. index = test.find(" S ")
  554. copy.seek(index-4)
  555. lat = copy.read(4)
  556. index = test.find(" E\n")
  557. copy.seek(index-4)
  558. long = copy.read(4)
  559. pres = pres.strip(' KT') #dont ask
  560. wind = wind.strip(' HPA') #^^^^
  561. if nameline.find("(") != -1:
  562. copy.seek(tmpind+5)
  563. name = copy.readline()
  564. name = name.strip(')\n')
  565. copy.close()
  566. tracksrc = open('track.txt','rb')
  567. tracksrc.seek(0)
  568. #temp = tracksrc.readline()
  569. #code = "%s%s" % (temp[2], temp[1])
  570. code = "%sR" % tmpcode
  571. test = tracksrc.read()
  572. #startindex = test.find(":c")
  573. test = test.strip(':c')
  574. tracksrc.close()
  575. trackwrt = open('track.txt','w+b')
  576. trackwrt.seek(0)
  577. thing = "%s %s\t-%s\t+%s\t%s\t%s\t/%s/\n" % (code, newproducttime, lat, long, pres, wind, name)
  578. trackwrt.write(test + thing)
  579. trackwrt.write(':c')
  580. trackwrt.close()
  581. return update
  582.  
  583. def wtpz21():
  584. file = urllib2.urlopen("http://weather.noaa.gov/pub/data/raw/wt/wtpz21.knhc.tcm.ep1.txt")
  585. output = open('wtpz21_1.txt','w+b')
  586. output.write(file.read())
  587. output.seek(0)
  588. header = output.read(6)
  589. output.seek(12)
  590. newproducttime = output.read(6)
  591. output.close()
  592. output = open('wtpz21.txt','rb')
  593. output.seek(12)
  594. producttime = output.read(6)
  595. output.close()
  596. if newproducttime != producttime:
  597. output = open('wtpz21.txt','w+b')
  598. copy = open('wtpz21_1.txt','rb')
  599. output.write(copy.read())
  600. #output.close()
  601. copy.seek(0)
  602. line_offset = []
  603. offset = 0
  604. for line in copy:
  605. line_offset.append(offset)
  606. offset += len(line)
  607. copy.seek(0)
  608. test = copy.read()
  609. index = test.find(" EP")
  610. copy.seek(index+1)
  611. name = copy.readline()
  612. name = name.strip('\n')
  613. index = test.find("NEAR")
  614. copy.seek(index+5)
  615. location = copy.readline()
  616. location = location.strip('\n')
  617. index = test.find("MOVEMENT")
  618. copy.seek(index+9)
  619. dir = copy.readline()
  620. dir = dir.strip('\n')
  621. index = test.find("PRESSURE")
  622. copy.seek(index+9)
  623. pres = copy.readline()
  624. pres = pres.strip('\n')
  625. index = test.find("WINDS")
  626. copy.seek(index+5)
  627. wind = copy.read(7)
  628. wind = wind.strip('\n')
  629. update = "WTPZ21 %s %s %s %s %s" % (name, location, dir, pres, wind)
  630. copy.close()
  631. return update
  632.  
  633. def wtpz22():
  634. file = urllib2.urlopen("http://weather.noaa.gov/pub/data/raw/wt/wtpz22.knhc.tcm.ep2.txt")
  635. output = open('wtpz22_1.txt','w+b')
  636. output.write(file.read())
  637. output.seek(0)
  638. header = output.read(6)
  639. output.seek(12)
  640. newproducttime = output.read(6)
  641. output.close()
  642. output = open('wtpz22.txt','rb')
  643. output.seek(12)
  644. producttime = output.read(6)
  645. output.close()
  646. if newproducttime != producttime:
  647. output = open('wtpz22.txt','w+b')
  648. copy = open('wtpz22_1.txt','rb')
  649. output.write(copy.read())
  650. #output.close()
  651. copy.seek(0)
  652. line_offset = []
  653. offset = 0
  654. for line in copy:
  655. line_offset.append(offset)
  656. offset += len(line)
  657. copy.seek(0)
  658. test = copy.read()
  659. index = test.find(" EP")
  660. copy.seek(index+1)
  661. name = copy.readline()
  662. name = name.strip('\n')
  663. index = test.find("NEAR")
  664. copy.seek(index+5)
  665. location = copy.readline()
  666. location = location.strip('\n')
  667. index = test.find("MOVEMENT")
  668. copy.seek(index+9)
  669. dir = copy.readline()
  670. dir = dir.strip('\n')
  671. index = test.find("PRESSURE")
  672. copy.seek(index+9)
  673. pres = copy.readline()
  674. pres = pres.strip('\n')
  675. index = test.find("WINDS")
  676. copy.seek(index+5)
  677. wind = copy.read(7)
  678. wind = wind.strip('\n')
  679. update = "WTPZ22 %s %s %s %s %s" % (name, location, dir, pres, wind)
  680. copy.close()
  681. return update
  682.  
  683. def wtpz23():
  684. file = urllib2.urlopen("http://weather.noaa.gov/pub/data/raw/wt/wtpz23.knhc.tcm.ep3.txt")
  685. output = open('wtpz23_1.txt','w+b')
  686. output.write(file.read())
  687. output.seek(0)
  688. header = output.read(6)
  689. output.seek(12)
  690. newproducttime = output.read(6)
  691. output.close()
  692. output = open('wtpz23.txt','rb')
  693. output.seek(12)
  694. producttime = output.read(6)
  695. output.close()
  696. if newproducttime != producttime:
  697. output = open('wtpz23.txt','w+b')
  698. copy = open('wtpz23_1.txt','rb')
  699. output.write(copy.read())
  700. #output.close()
  701. copy.seek(0)
  702. line_offset = []
  703. offset = 0
  704. for line in copy:
  705. line_offset.append(offset)
  706. offset += len(line)
  707. copy.seek(0)
  708. test = copy.read()
  709. index = test.find(" EP")
  710. copy.seek(index+1)
  711. name = copy.readline()
  712. name = name.strip('\n')
  713. index = test.find("NEAR")
  714. copy.seek(index+5)
  715. location = copy.readline()
  716. location = location.strip('\n')
  717. index = test.find("MOVEMENT")
  718. copy.seek(index+9)
  719. dir = copy.readline()
  720. dir = dir.strip('\n')
  721. index = test.find("PRESSURE")
  722. copy.seek(index+9)
  723. pres = copy.readline()
  724. pres = pres.strip('\n')
  725. index = test.find("WINDS")
  726. copy.seek(index+5)
  727. wind = copy.read(7)
  728. wind = wind.strip('\n')
  729. update = "WTPZ23 %s %s %s %s %s" % (name, location, dir, pres, wind)
  730. copy.close()
  731. return update
  732.  
  733. def wtpz24():
  734. file = urllib2.urlopen("http://weather.noaa.gov/pub/data/raw/wt/wtpz24.knhc.tcm.ep4.txt")
  735. output = open('wtpz24_1.txt','w+b')
  736. output.write(file.read())
  737. output.seek(0)
  738. header = output.read(6)
  739. output.seek(12)
  740. newproducttime = output.read(6)
  741. output.close()
  742. output = open('wtpz24.txt','rb')
  743. output.seek(12)
  744. producttime = output.read(6)
  745. output.close()
  746. if newproducttime != producttime:
  747. output = open('wtpz24.txt','w+b')
  748. copy = open('wtpz24_1.txt','rb')
  749. output.write(copy.read())
  750. #output.close()
  751. copy.seek(0)
  752. line_offset = []
  753. offset = 0
  754. for line in copy:
  755. line_offset.append(offset)
  756. offset += len(line)
  757. copy.seek(0)
  758. test = copy.read()
  759. index = test.find(" EP")
  760. copy.seek(index+1)
  761. name = copy.readline()
  762. name = name.strip('\n')
  763. index = test.find("NEAR")
  764. copy.seek(index+5)
  765. location = copy.readline()
  766. location = location.strip('\n')
  767. index = test.find("MOVEMENT")
  768. copy.seek(index+9)
  769. dir = copy.readline()
  770. dir = dir.strip('\n')
  771. index = test.find("PRESSURE")
  772. copy.seek(index+9)
  773. pres = copy.readline()
  774. pres = pres.strip('\n')
  775. index = test.find("WINDS")
  776. copy.seek(index+5)
  777. wind = copy.read(7)
  778. wind = wind.strip('\n')
  779. update = "WTPZ24 %s %s %s %s %s" % (name, location, dir, pres, wind)
  780. copy.close()
  781. return update
  782.  
  783. def wtpz25():
  784. file = urllib2.urlopen("http://weather.noaa.gov/pub/data/raw/wt/wtpz25.knhc.tcm.ep5.txt")
  785. output = open('wtpz25_1.txt','w+b')
  786. output.write(file.read())
  787. output.seek(0)
  788. header = output.read(6)
  789. output.seek(12)
  790. newproducttime = output.read(6)
  791. output.close()
  792. output = open('wtpz25.txt','rb')
  793. output.seek(12)
  794. producttime = output.read(6)
  795. output.close()
  796. if newproducttime != producttime:
  797. output = open('wtpz25.txt','w+b')
  798. copy = open('wtpz25_1.txt','rb')
  799. output.write(copy.read())
  800. #output.close()
  801. copy.seek(0)
  802. line_offset = []
  803. offset = 0
  804. for line in copy:
  805. line_offset.append(offset)
  806. offset += len(line)
  807. copy.seek(0)
  808. test = copy.read()
  809. index = test.find(" EP")
  810. copy.seek(index+1)
  811. name = copy.readline()
  812. name = name.strip('\n')
  813. index = test.find("NEAR")
  814. copy.seek(index+5)
  815. location = copy.readline()
  816. location = location.strip('\n')
  817. index = test.find("MOVEMENT")
  818. copy.seek(index+9)
  819. dir = copy.readline()
  820. dir = dir.strip('\n')
  821. index = test.find("PRESSURE")
  822. copy.seek(index+9)
  823. pres = copy.readline()
  824. pres = pres.strip('\n')
  825. index = test.find("WINDS")
  826. copy.seek(index+5)
  827. wind = copy.read(7)
  828. wind = wind.strip('\n')
  829. update = "WTPZ25 %s %s %s %s %s" % (name, location, dir, pres, wind)
  830. copy.close()
  831. return update
  832.  
  833. def wwps21():# WHY IS THIS NOT WORKING UGH
  834. file = urllib2.urlopen("http://weather.noaa.gov/pub/data/raw/ww/wwps21.nffn..txt")
  835. output = open('wwps21_1.txt','w+b')
  836. output.write(file.read())
  837. output.seek(0)
  838. header = output.read(6)
  839. output.seek(12)
  840. newproducttime = output.read(6)
  841. output.close()
  842. output = open('wwps21.txt','rb')
  843. output.seek(12)
  844. producttime = output.read(6)
  845. output.close()
  846. if newproducttime != producttime:
  847. output = open('wwps21.txt','w+b')
  848. copy = open('wwps21_1.txt','rb')
  849. output.write(copy.read())
  850. #output.close()
  851. copy.seek(0)
  852. line_offset = []
  853. offset = 0
  854. for line in copy:
  855. line_offset.append(offset)
  856. offset += len(line)
  857. copy.seek(0)
  858. test = copy.read()
  859. if findnth(test, "TROPICAL DISTURBANCE", 2) != -1:
  860. index = findnth(test, "TROPICAL DISTURBANCE", 2)
  861. copy.seek(index+2)
  862. name = copy.readline()
  863. name = name.strip('\n')
  864. index = test.find("MOVING")
  865. copy.seek(index)
  866. location = copy.readline()
  867. location = location.strip('\n')
  868. index = test.find("POTENTIAL FOR")
  869. copy.seek(index)
  870. potential = copy.read(54)
  871. potential = potential.strip('\n')
  872. copy.seek(index+80)
  873. pot2 = copy.readline()
  874. pot2 = pot2.strip('\n')
  875. update = "WWPS21 %s %s %s %s" % (name, location, potential, pot2)
  876. copy.close()
  877. return update
  878. elif test.find("TROPICAL DEPRESSION") != -1:
  879. index = test.find("TROPICAL DEPRESSION")
  880. copy.seek(index)
  881. name = copy.readline()
  882. name = name.strip('\n')
  883. index = test.find("MOVING")
  884. copy.seek(index)
  885. location = copy.readline()
  886. location = location.strip('\n')
  887. index = test.find("POTENTIAL FOR")
  888. if index != -1:
  889. copy.seek(index)
  890. potential = copy.read(54)
  891. potential = potential.strip('\n')
  892. copy.seek(index+80)
  893. pot2 = copy.readline()
  894. pot2 = pot2.strip('\n')
  895. update = "WWPS21 %s %s %s %s" % (name, location, potential, pot2)
  896. update = "WWPS21 %s %s" % (name, location)
  897. copy.close()
  898. return update
  899. else:
  900. pass
  901.  
  902. def wtps11():
  903. file = urllib2.urlopen("http://weather.noaa.gov/pub/data/raw/wt/wtps11.nffn..txt")
  904. output = open('wtps11_1.txt','w+b')
  905. output.write(file.read())
  906. output.seek(0)
  907. header = output.read(6)
  908. output.seek(12)
  909. newproducttime = output.read(6)
  910. output.close()
  911. output = open('wtps11.txt','rb')
  912. output.seek(12)
  913. producttime = output.read(6)
  914. output.close()
  915. if newproducttime != producttime:
  916. output = open('wtps11.txt','w+b')
  917. copy = open('wtps11_1.txt','rb')
  918. output.write(copy.read())
  919. #output.close()
  920. copy.seek(0)
  921. line_offset = []
  922. offset = 0
  923. for line in copy:
  924. line_offset.append(offset)
  925. offset += len(line)
  926. copy.seek(0)
  927. test = copy.read()
  928. index = test.find("UTC.")
  929. index2 = findnth(test, "UTC.", 1)
  930. index2 = index2 - index
  931. copy.seek(index+5)
  932. name = copy.read(index2)
  933. name = name.replace('\n', ' ')
  934. index = test.find("POSITION")
  935. copy.seek(index)
  936. pos = copy.read(13)
  937. index = test.find("MOVING")
  938. index2 = findnth(test, ".", 5)
  939. copy.seek(index)
  940. dir = copy.read(index2 - (index))
  941. index = findnth(test, "KNOTS", 1)
  942. copy.seek(index-4)
  943. wind = copy.read(10)
  944. wind = wind.replace('\n', ' ')
  945. update = "WTPS11 %s %s %s %s KNOTS." % (name, wind, pos, dir)
  946. copy.close()
  947. return update
  948.  
  949. def axau01():
  950. file = urllib2.urlopen("http://weather.noaa.gov/pub/data/raw/ax/axau01.aprf..txt")
  951. output = open('axau01_1.txt','w+b')
  952. output.write(file.read())
  953. output.seek(0)
  954. header = output.read(6)
  955. output.seek(12)
  956. newproducttime = output.read(6)
  957. output.close()
  958. output = open('axau01.txt','rb')
  959. output.seek(12)
  960. producttime = output.read(6)
  961. output.close()
  962. if newproducttime != producttime:
  963. output = open('axau01.txt','w+b')
  964. copy = open('axau01_1.txt','rb')
  965. output.write(copy.read())
  966. #output.close()
  967. copy.seek(0)
  968. line_offset = []
  969. offset = 0
  970. for line in copy:
  971. line_offset.append(offset)
  972. offset += len(line)
  973. copy.seek(line_offset[5]+6)
  974. name = copy.readline()
  975. name = name.strip('\n')
  976. name = name.strip(' ')
  977. if name == "Tropical Low  " or name == "Tropical Low " or name == "Tropical Low":
  978. copy.seek(line_offset[6]+12)
  979. id = copy.readline()
  980. id = id.strip('\n')
  981. copy.seek(line_offset[6]+12)
  982. id = copy.readline()
  983. id = id.strip('\n')
  984. copy.seek(line_offset[8]+10)
  985. lat = copy.readline()
  986. lat = lat.strip('\n')
  987. copy.seek(line_offset[9]+11)
  988. long = copy.readline()
  989. long = long.strip('\n')
  990. copy.seek(line_offset[10]+18)
  991. acc = copy.readline()
  992. acc = acc.strip('\n')
  993. copy.seek(line_offset[11]+17)
  994. dir = copy.readline()
  995. dir = dir.strip('\n')
  996. copy.seek(line_offset[12]+18)
  997. dirs = copy.readline()
  998. dirs = dirs.strip('\n')
  999. copy.seek(line_offset[15]+17)
  1000. pres = copy.readline()
  1001. pres = pres.strip('\n')
  1002. copy.seek(line_offset[13]+23)
  1003. wind = copy.readline()
  1004. wind = wind.strip('\n')
  1005. if name == "Tropical Low  " or name == "Tropical Low " or name == "Tropical Low":
  1006. update = "AXAU01 %s %s %s %s %s %s %s %s %s" % (name, id, lat, long, acc, dir, dirs, wind, pres)
  1007. else:
  1008. update = "AXAU01 %s %s %s %s %s %s %s %s" % (name, lat, long, acc, dir, dirs, wind, pres)
  1009. copy.close()
  1010. #############
  1011. tracksrc = open('track.txt','rb')
  1012. tracksrc.seek(0)
  1013. pres = pres.strip(' hPa')
  1014. wind = wind[:3]
  1015. lat = lat.strip('S\n')
  1016. long = long.strip('E\n')
  1017. namearr = name.split(' ')
  1018. test = tracksrc.read()
  1019. test = test.strip(':c')
  1020. tracksrc.close()
  1021. trackwrt = open('track.txt','w+b')
  1022. trackwrt.seek(0)
  1023. thing = "%s %s\t-%s\t+%s\t%s\t%s\t/%s/\n" % (id, newproducttime, lat, long, wind, pres, namearr[len(namearr)-1])
  1024. trackwrt.write(test + thing)
  1025. trackwrt.write(':c')
  1026. trackwrt.close()
  1027. return update
  1028.  
  1029. def axau02():
  1030. file = urllib2.urlopen("http://weather.noaa.gov/pub/data/raw/ax/axau02.aprf..txt")
  1031. output = open('axau02_1.txt','w+b')
  1032. output.write(file.read())
  1033. output.seek(0)
  1034. header = output.read(6)
  1035. output.seek(12)
  1036. newproducttime = output.read(6)
  1037. output.close()
  1038. output = open('axau02.txt','rb')
  1039. output.seek(12)
  1040. producttime = output.read(6)
  1041. output.close()
  1042. if newproducttime != producttime:
  1043. output = open('axau02.txt','w+b')
  1044. copy = open('axau02_1.txt','rb')
  1045. output.write(copy.read())
  1046. #output.close()
  1047. copy.seek(0)
  1048. line_offset = []
  1049. offset = 0
  1050. for line in copy:
  1051. line_offset.append(offset)
  1052. offset += len(line)
  1053. copy.seek(line_offset[5]+6)
  1054. name = copy.readline()
  1055. name = name.strip('\n')
  1056. name = name.strip(' ')
  1057. if name == "Tropical Low  " or name == "Tropical Low " or name == "Tropical Low":
  1058. copy.seek(line_offset[6]+12)
  1059. id = copy.readline()
  1060. id = id.strip('\n')
  1061. copy.seek(line_offset[8]+10)
  1062. lat = copy.readline()
  1063. lat = lat.strip('\n')
  1064. copy.seek(line_offset[9]+11)
  1065. long = copy.readline()
  1066. long = long.strip('\n')
  1067. copy.seek(line_offset[10]+18)
  1068. acc = copy.readline()
  1069. acc = acc.strip('\n')
  1070. copy.seek(line_offset[11]+17)
  1071. dir = copy.readline()
  1072. dir = dir.strip('\n')
  1073. copy.seek(line_offset[12]+18)
  1074. dirs = copy.readline()
  1075. dirs = dirs.strip('\n')
  1076. copy.seek(line_offset[15]+17)
  1077. pres = copy.readline()
  1078. pres = pres.strip('\n')
  1079. copy.seek(line_offset[13]+23)
  1080. wind = copy.readline()
  1081. wind = wind.strip('\n')
  1082. if name == "Tropical Low  " or name == "Tropical Low " or name == "Tropical Low":
  1083. update = "AXAU02 %s %s %s %s %s %s %s %s %s" % (name, id, lat, long, acc, dir, dirs, wind, pres)
  1084. else:
  1085. update = "AXAU02 %s %s %s %s %s %s %s %s" % (name, lat, long, acc, dir, dirs, wind, pres)
  1086. copy.close()
  1087. #############
  1088. tracksrc = open('track.txt','rb')
  1089. tracksrc.seek(0)
  1090. pres = pres.strip(' hPa')
  1091. wind = wind[:3]
  1092. lat = lat.strip('S\n')
  1093. long = long.strip('E\n')
  1094. namearr = name.split(' ')
  1095. test = tracksrc.read()
  1096. test = test.strip(':c')
  1097. tracksrc.close()
  1098. trackwrt = open('track.txt','w+b')
  1099. trackwrt.seek(0)
  1100. thing = "%s %s\t-%s\t+%s\t%s\t%s\t/%s/\n" % (id, newproducttime, lat, long, wind, pres, namearr[len(namearr)-1])
  1101. trackwrt.write(test + thing)
  1102. trackwrt.write(':c')
  1103. trackwrt.close()
  1104. return update
  1105.  
  1106. def axau03():
  1107. file = urllib2.urlopen("http://weather.noaa.gov/pub/data/raw/ax/axau03.aprf..txt")
  1108. output = open('axau03_1.txt','w+b')
  1109. output.write(file.read())
  1110. output.seek(0)
  1111. header = output.read(6)
  1112. output.seek(12)
  1113. newproducttime = output.read(6)
  1114. output.close()
  1115. output = open('axau03.txt','rb')
  1116. output.seek(12)
  1117. producttime = output.read(6)
  1118. output.close()
  1119. if newproducttime != producttime:
  1120. output = open('axau03.txt','w+b')
  1121. copy = open('axau03_1.txt','rb')
  1122. output.write(copy.read())
  1123. #output.close()
  1124. copy.seek(0)
  1125. line_offset = []
  1126. offset = 0
  1127. for line in copy:
  1128. line_offset.append(offset)
  1129. offset += len(line)
  1130. copy.seek(line_offset[5]+6)
  1131. name = copy.readline()
  1132. name = name.strip('\n')
  1133. name = name.strip(' ')
  1134. if name == "Tropical Low  " or name == "Tropical Low " or name == "Tropical Low":
  1135. copy.seek(line_offset[6]+12)
  1136. id = copy.readline()
  1137. id = id.strip('\n')
  1138. copy.seek(line_offset[8]+10)
  1139. lat = copy.readline()
  1140. lat = lat.strip('\n')
  1141. copy.seek(line_offset[9]+11)
  1142. long = copy.readline()
  1143. long = long.strip('\n')
  1144. copy.seek(line_offset[10]+18)
  1145. acc = copy.readline()
  1146. acc = acc.strip('\n')
  1147. copy.seek(line_offset[11]+17)
  1148. dir = copy.readline()
  1149. dir = dir.strip('\n')
  1150. copy.seek(line_offset[12]+18)
  1151. dirs = copy.readline()
  1152. dirs = dirs.strip('\n')
  1153. copy.seek(line_offset[15]+17)
  1154. pres = copy.readline()
  1155. pres = pres.strip('\n')
  1156. copy.seek(line_offset[13]+23)
  1157. wind = copy.readline()
  1158. wind = wind.strip('\n')
  1159. if name == "Tropical Low  " or name == "Tropical Low " or name == "Tropical Low":
  1160. update = "AXAU03 %s %s %s %s %s %s %s %s %s" % (name, id, lat, long, acc, dir, dirs, wind, pres)
  1161. else:
  1162. update = "AXAU03 %s %s %s %s %s %s %s %s" % (name, lat, long, acc, dir, dirs, wind, pres)
  1163. copy.close()
  1164. return update
  1165.  
  1166. def axau01_adrm():
  1167. file = urllib2.urlopen("http://weather.noaa.gov/pub/data/raw/ax/axau01.adrm..txt")
  1168. output = open('axau01_adrm_1.txt','w+b')
  1169. output.write(file.read())
  1170. output.seek(0)
  1171. header = output.read(6)
  1172. output.seek(12)
  1173. newproducttime = output.read(6)
  1174. output.close()
  1175. output = open('axau01_adrm.txt','rb')
  1176. output.seek(12)
  1177. producttime = output.read(6)
  1178. output.close()
  1179. if newproducttime != producttime:
  1180. output = open('axau01_adrm.txt','w+b')
  1181. copy = open('axau01_adrm_1.txt','rb')
  1182. output.write(copy.read())
  1183. #output.close()
  1184. copy.seek(0)
  1185. line_offset = []
  1186. offset = 0
  1187. for line in copy:
  1188. line_offset.append(offset)
  1189. offset += len(line)
  1190. copy.seek(line_offset[5]+6)
  1191. name = copy.readline()
  1192. name = name.strip('\n')
  1193. name = name.strip(' ')
  1194. if name == "Tropical Low  " or name == "Tropical Low " or name == "Tropical Low":
  1195. copy.seek(line_offset[6]+12)
  1196. id = copy.readline()
  1197. id = id.strip('\n')
  1198. copy.seek(line_offset[8]+10)
  1199. lat = copy.readline()
  1200. lat = lat.strip('\n')
  1201. copy.seek(line_offset[9]+11)
  1202. long = copy.readline()
  1203. long = long.strip('\n')
  1204. copy.seek(line_offset[10]+18)
  1205. acc = copy.readline()
  1206. acc = acc.strip('\n')
  1207. copy.seek(line_offset[11]+17)
  1208. dir = copy.readline()
  1209. dir = dir.strip('\n')
  1210. copy.seek(line_offset[12]+18)
  1211. dirs = copy.readline()
  1212. dirs = dirs.strip('\n')
  1213. copy.seek(line_offset[15]+17)
  1214. pres = copy.readline()
  1215. pres = pres.strip('\n')
  1216. copy.seek(line_offset[13]+23)
  1217. wind = copy.readline()
  1218. wind = wind.strip('\n')
  1219. if name == "Tropical Low  " or name == "Tropical Low " or name == "Tropical Low":
  1220. update = "AXAU01 %s %s %s %s %s %s %s %s %s" % (name, id, lat, long, acc, dir, dirs, wind, pres)
  1221. else:
  1222. update = "AXAU01 %s %s %s %s %s %s %s %s" % (name, lat, long, acc, dir, dirs, wind, pres)
  1223. copy.close()
  1224. return update
  1225.  
  1226. def axau21():
  1227. file = urllib2.urlopen("http://weather.noaa.gov/pub/data/raw/ax/axau21.abrf..txt")
  1228. output = open('axau21_1.txt','w+b')
  1229. output.write(file.read())
  1230. output.seek(0)
  1231. header = output.read(6)
  1232. output.seek(12)
  1233. newproducttime = output.read(6)
  1234. output.close()
  1235. output = open('axau21.txt','rb')
  1236. output.seek(12)
  1237. producttime = output.read(6)
  1238. output.close()
  1239. if newproducttime != producttime:
  1240. output = open('axau21.txt','w+b')
  1241. copy = open('axau21_1.txt','rb')
  1242. output.write(copy.read())
  1243. #output.close()
  1244. copy.seek(0)
  1245. line_offset = []
  1246. offset = 0
  1247. for line in copy:
  1248. line_offset.append(offset)
  1249. offset += len(line)
  1250. copy.seek(line_offset[5]+6)
  1251. name = copy.readline()
  1252. name = name.strip('\n')
  1253. name = name.strip(' ')
  1254. if name == "Tropical Low  " or name == "Tropical Low " or name == "Tropical Low":
  1255. copy.seek(line_offset[6]+12)
  1256. id = copy.readline()
  1257. id = id.strip('\n')
  1258. copy.seek(line_offset[8]+10)
  1259. lat = copy.readline()
  1260. lat = lat.strip('\n')
  1261. copy.seek(line_offset[9]+11)
  1262. long = copy.readline()
  1263. long = long.strip('\n')
  1264. copy.seek(line_offset[10]+18)
  1265. acc = copy.readline()
  1266. acc = acc.strip('\n')
  1267. copy.seek(line_offset[11]+17)
  1268. dir = copy.readline()
  1269. dir = dir.strip('\n')
  1270. copy.seek(line_offset[12]+18)
  1271. dirs = copy.readline()
  1272. dirs = dirs.strip('\n')
  1273. copy.seek(line_offset[15]+17)
  1274. pres = copy.readline()
  1275. pres = pres.strip('\n')
  1276. copy.seek(line_offset[13]+23)
  1277. wind = copy.readline()
  1278. wind = wind.strip('\n')
  1279. if name == "Tropical Low  " or name == "Tropical Low " or name == "Tropical Low":
  1280. update = "AXAU21 %s %s %s %s %s %s %s %s %s" % (name, id, lat, long, acc, dir, dirs, wind, pres)
  1281. else:
  1282. update = "AXAU21 %s %s %s %s %s %s %s %s" % (name, lat, long, acc, dir, dirs, wind, pres)
  1283. copy.close()
  1284. return update
  1285. [/code]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement