mattritchey commited on
Commit
2752b4d
·
verified ·
1 Parent(s): fad6609

Update pages/Hail.py

Browse files
Files changed (1) hide show
  1. pages/Hail.py +11 -3
pages/Hail.py CHANGED
@@ -27,7 +27,7 @@ from requests.packages.urllib3.exceptions import InsecureRequestWarning
27
  import rasterio
28
  import rioxarray
29
  import numpy as np
30
-
31
  # from urllib import request
32
  # import certifi
33
  # import ssl
@@ -62,7 +62,11 @@ def geocode(address, buffer_size):
62
  def get_pngs(date):
63
  year, month, day = date[:4], date[4:6], date[6:]
64
  url = f'https://mrms.nssl.noaa.gov/qvs/product_viewer/local/render_multi_domain_product_layer.php?mode=run&cpp_exec_dir=/home/metop/web/specific/opv/&web_resources_dir=/var/www/html/qvs/product_viewer/resources/&prod_root={prod_root}&qperate_pal_option=0&qpe_pal_option=0&year={year}&month={month}&day={day}&hour={hour}&minute={minute}&clon={lon}&clat={lat}&zoom={zoom}&width=920&height=630'
65
- data = imread(url,verify=False)[:, :, :3]
 
 
 
 
66
  data2 = data.reshape(630*920, 3)
67
  data2_df = pd.DataFrame(data2, columns=['R', 'G', 'B'])
68
  data2_df2 = pd.merge(data2_df, lut[['R', 'G', 'B', 'Hail Scale', 'Hail Scale In']], on=['R', 'G', 'B'],
@@ -82,7 +86,11 @@ def get_pngs_parallel(dates):
82
  def png_data(date):
83
  year, month, day = date[:4], date[4:6], date[6:]
84
  url = f'https://mrms.nssl.noaa.gov/qvs/product_viewer/local/render_multi_domain_product_layer.php?mode=run&cpp_exec_dir=/home/metop/web/specific/opv/&web_resources_dir=/var/www/html/qvs/product_viewer/resources/&prod_root={prod_root}&qperate_pal_option=0&qpe_pal_option=0&year={year}&month={month}&day={day}&hour={hour}&minute={minute}&clon={lon}&clat={lat}&zoom={zoom}&width=920&height=630'
85
- data = imread(url,verify=False)
 
 
 
 
86
  return data
87
 
88
 
 
27
  import rasterio
28
  import rioxarray
29
  import numpy as np
30
+ import io
31
  # from urllib import request
32
  # import certifi
33
  # import ssl
 
62
  def get_pngs(date):
63
  year, month, day = date[:4], date[4:6], date[6:]
64
  url = f'https://mrms.nssl.noaa.gov/qvs/product_viewer/local/render_multi_domain_product_layer.php?mode=run&cpp_exec_dir=/home/metop/web/specific/opv/&web_resources_dir=/var/www/html/qvs/product_viewer/resources/&prod_root={prod_root}&qperate_pal_option=0&qpe_pal_option=0&year={year}&month={month}&day={day}&hour={hour}&minute={minute}&clon={lon}&clat={lat}&zoom={zoom}&width=920&height=630'
65
+ # data = imread(url,verify=False)[:, :, :3]
66
+ response = requests.get(url,verify=False)
67
+ image_data = io.BytesIO(response.content)
68
+ data = imread(image_data)[:, :, :3]
69
+
70
  data2 = data.reshape(630*920, 3)
71
  data2_df = pd.DataFrame(data2, columns=['R', 'G', 'B'])
72
  data2_df2 = pd.merge(data2_df, lut[['R', 'G', 'B', 'Hail Scale', 'Hail Scale In']], on=['R', 'G', 'B'],
 
86
  def png_data(date):
87
  year, month, day = date[:4], date[4:6], date[6:]
88
  url = f'https://mrms.nssl.noaa.gov/qvs/product_viewer/local/render_multi_domain_product_layer.php?mode=run&cpp_exec_dir=/home/metop/web/specific/opv/&web_resources_dir=/var/www/html/qvs/product_viewer/resources/&prod_root={prod_root}&qperate_pal_option=0&qpe_pal_option=0&year={year}&month={month}&day={day}&hour={hour}&minute={minute}&clon={lon}&clat={lat}&zoom={zoom}&width=920&height=630'
89
+ response = requests.get(url,verify=False)
90
+ image_data = io.BytesIO(response.content)
91
+ data = imread(image_data)
92
+
93
+ # data = imread(url,verify=False)
94
  return data
95
 
96