Skip to content
Snippets Groups Projects
Commit f33127f4 authored by tomrink's avatar tomrink
Browse files

snapshot...

parent 7a666b03
Branches
No related tags found
No related merge requests found
...@@ -3,8 +3,6 @@ from datetime import timezone ...@@ -3,8 +3,6 @@ from datetime import timezone
import re import re
import numpy as np import numpy as np
from icing.pirep_goes import get_goes_datasource
NO_ICE = '\s*NEG\s*|\s*NONE\s*|\s*NEGATIVE\s*|\s*NO\s*' NO_ICE = '\s*NEG\s*|\s*NONE\s*|\s*NEGATIVE\s*|\s*NO\s*'
ICE_LVL = '\d+-\d+|FL\d+-FL\d+' ICE_LVL = '\d+-\d+|FL\d+-FL\d+'
FLT_LVL = '/FL\s{0,1}\d+\s*' FLT_LVL = '/FL\s{0,1}\d+\s*'
...@@ -110,28 +108,28 @@ def pirep_icing(filename, lon_range=[-180, 180], lat_range=[-55, 55]): ...@@ -110,28 +108,28 @@ def pirep_icing(filename, lon_range=[-180, 180], lat_range=[-55, 55]):
return ice_dict, no_ice_dict return ice_dict, no_ice_dict
def analyze(ice_dct, no_ice_dct): # def analyze(ice_dct, no_ice_dct):
ice_times = np.array(list(ice_dct.keys())) # ice_times = np.array(list(ice_dct.keys()))
no_ice_times = np.array(list(no_ice_dct.keys())) # no_ice_times = np.array(list(no_ice_dct.keys()))
#
dt_str = '201601010000' # dt_str = '201601010000'
dto = datetime.datetime.strptime(dt_str, '%Y%m%d%H%M').replace(tzinfo=timezone.utc) # dto = datetime.datetime.strptime(dt_str, '%Y%m%d%H%M').replace(tzinfo=timezone.utc)
t0 = dto.timestamp() # t0 = dto.timestamp()
#
dt_str = '201906300000' # dt_str = '201906300000'
dto = datetime.datetime.strptime(dt_str, '%Y%m%d%H%M').replace(tzinfo=timezone.utc) # dto = datetime.datetime.strptime(dt_str, '%Y%m%d%H%M').replace(tzinfo=timezone.utc)
t1 = dto.timestamp() # t1 = dto.timestamp()
#
tline = np.arange(t0, t1, 600) # tline = np.arange(t0, t1, 600)
hist_a, edges = np.histogram(no_ice_times, bins=tline) # hist_a, edges = np.histogram(no_ice_times, bins=tline)
print(len(np.nonzero(hist_a)[0])) # print(len(np.nonzero(hist_a)[0]))
#
hist_b, edges = np.histogram(ice_times, bins=tline) # hist_b, edges = np.histogram(ice_times, bins=tline)
print(len(np.nonzero(hist_b)[0])) # print(len(np.nonzero(hist_b)[0]))
#
print(np.sum(np.logical_and(hist_a > 0, hist_b > 0))) # print(np.sum(np.logical_and(hist_a > 0, hist_b > 0)))
#
for ts in list(no_ice_dct.keys()): # for ts in list(no_ice_dct.keys()):
ds = get_goes_datasource(ts) # ds = get_goes_datasource(ts)
goes_file = ds.get_file(ts)[0] # goes_file = ds.get_file(ts)[0]
print(goes_file) # print(goes_file)
\ No newline at end of file \ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment