Caught up to C++
Signed-off-by: fly <merspieler@airmail.cc>
This commit is contained in:
parent
7be97e1a91
commit
a5c1e72cac
6 changed files with 191 additions and 0 deletions
19
aloftWxr.py
19
aloftWxr.py
|
@ -1,8 +1,27 @@
|
||||||
#! /usr/bin/python3
|
#! /usr/bin/python3
|
||||||
|
# Copyright (C) 2020 Merspieler, merspieler _at_ airmail.cc
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License as
|
||||||
|
# published by the Free Software Foundation; either version 3 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but
|
||||||
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
# General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
import pygrib
|
import pygrib
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from config import config
|
from config import config
|
||||||
|
from dataCycle import dataCycle
|
||||||
|
from fg import connection
|
||||||
|
from wind import windpoint
|
||||||
|
from functions import getForecast, getFilename, getMillibars
|
||||||
|
|
||||||
conf = config()
|
conf = config()
|
||||||
|
|
16
config.py
16
config.py
|
@ -1,3 +1,19 @@
|
||||||
|
# Copyright (C) 2020 Merspieler, merspieler _at_ airmail.cc
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License as
|
||||||
|
# published by the Free Software Foundation; either version 3 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but
|
||||||
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
# General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
28
dataCycle.py
28
dataCycle.py
|
@ -0,0 +1,28 @@
|
||||||
|
# Copyright (C) 2020 Merspieler, merspieler _at_ airmail.cc
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License as
|
||||||
|
# published by the Free Software Foundation; either version 3 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but
|
||||||
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
# General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
from time import time, gmtime
|
||||||
|
|
||||||
|
class dataCycle:
|
||||||
|
def __init__(self):
|
||||||
|
timeStamp = gmtime(time() - 18000)
|
||||||
|
self.hour = timeStamp.tm_hour
|
||||||
|
self.day = timeStamp.tm_mday
|
||||||
|
self.month = timeStamp.tm_mon
|
||||||
|
self.year = timeStamp.tm_year
|
||||||
|
self.cycle = self.hour - (self.hour % 6)
|
||||||
|
def getString(self):
|
||||||
|
return '{:04d}{:02d}{:02d}/{:02d}'.format(self.year, self.month, self.day, self.cycle)
|
20
fg.py
20
fg.py
|
@ -0,0 +1,20 @@
|
||||||
|
# Copyright (C) 2020 Merspieler, merspieler _at_ airmail.cc
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License as
|
||||||
|
# published by the Free Software Foundation; either version 3 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but
|
||||||
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
# General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
class connection:
|
||||||
|
def sendData(wp):
|
||||||
|
# TODO
|
||||||
|
pass
|
79
functions.py
79
functions.py
|
@ -0,0 +1,79 @@
|
||||||
|
# Copyright (C) 2020 Merspieler, merspieler _at_ airmail.cc
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License as
|
||||||
|
# published by the Free Software Foundation; either version 3 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but
|
||||||
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
# General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
from time import time, gmtime
|
||||||
|
|
||||||
|
def getForecast(cycle):
|
||||||
|
ts = gmtime(time() - 18000)
|
||||||
|
return ts.tm_hour - (ts.tm_hour % 3)
|
||||||
|
|
||||||
|
def getFilename(dc, fc):
|
||||||
|
return 'gfs.t{:02d}z.pgrb2full.0p50.f0{:02d}'.format(dc.cycle, fc)
|
||||||
|
|
||||||
|
def getMillibars(alt):
|
||||||
|
if alt < 710 or alt > 54000: # 1000mb and 75mb
|
||||||
|
return -9999;
|
||||||
|
if alt >= 710 and alt < 1410:
|
||||||
|
return 975;
|
||||||
|
if alt >= 1410 and alt < 2135:
|
||||||
|
return 950;
|
||||||
|
if alt >= 2135 and alt < 2875:
|
||||||
|
return 925;
|
||||||
|
if alt >= 2875 and alt < 4000:
|
||||||
|
return 900;
|
||||||
|
if alt >= 4000 and alt < 5600:
|
||||||
|
return 850;
|
||||||
|
if alt >= 5600 and alt < 7235:
|
||||||
|
return 800;
|
||||||
|
if alt >= 7235 and alt < 8995:
|
||||||
|
return 750;
|
||||||
|
if alt >= 8995 and alt < 10820:
|
||||||
|
return 700;
|
||||||
|
if alt >= 10820 and alt < 12775:
|
||||||
|
return 650;
|
||||||
|
if alt >= 12775 and alt < 14865:
|
||||||
|
return 600;
|
||||||
|
if alt >= 14865 and alt < 17100:
|
||||||
|
return 550;
|
||||||
|
if alt >= 17100 and alt < 19530:
|
||||||
|
return 500;
|
||||||
|
if alt >= 19530 and alt < 22160:
|
||||||
|
return 450;
|
||||||
|
if alt >= 22160 and alt < 25065:
|
||||||
|
return 400;
|
||||||
|
if alt >= 25065 and alt < 27450:
|
||||||
|
return 350;
|
||||||
|
if alt >= 27450 and alt < 29170:
|
||||||
|
return 325;
|
||||||
|
if alt >= 29170 and alt < 31000:
|
||||||
|
return 300;
|
||||||
|
if alt >= 31000 and alt < 32965:
|
||||||
|
return 275;
|
||||||
|
if alt >= 32965 and alt < 35100:
|
||||||
|
return 250;
|
||||||
|
if alt >= 35100 and alt < 37400:
|
||||||
|
return 225;
|
||||||
|
if alt >= 37400 and alt < 39950:
|
||||||
|
return 200;
|
||||||
|
if alt >= 39950 and alt < 42800:
|
||||||
|
return 175;
|
||||||
|
if alt >= 42800 and alt < 46000:
|
||||||
|
return 150;
|
||||||
|
if alt >= 46000 and alt < 49750:
|
||||||
|
return 125;
|
||||||
|
if alt >= 49750 and alt < 54000:
|
||||||
|
return 100;
|
||||||
|
return -9999;
|
29
wind.py
29
wind.py
|
@ -0,0 +1,29 @@
|
||||||
|
# Copyright (C) 2020 Merspieler, merspieler _at_ airmail.cc
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License as
|
||||||
|
# published by the Free Software Foundation; either version 3 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but
|
||||||
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
# General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
class wind:
|
||||||
|
direction = 0
|
||||||
|
speed = 0
|
||||||
|
|
||||||
|
class windpoint:
|
||||||
|
def __init__(self):
|
||||||
|
self.lat = 0
|
||||||
|
self.lon = 0
|
||||||
|
self.winds = []
|
||||||
|
i = 0
|
||||||
|
while i < 9:
|
||||||
|
self.winds.append(wind())
|
||||||
|
i += 1
|
Loading…
Reference in a new issue