예제 #1
0
        lat = model_data[st]['lat']
        lon = model_data[st]['lon']
        popupstring = "HF Radar: [" + str(lat) + ":" + str(
            lon) + "]" + "<br>for<br>" + ent['name']
        map.circle_marker([lat, lon],
                          popup=popupstring,
                          radius=500,
                          line_color='#66FF33',
                          fill_color='#66FF33',
                          fill_opacity=0.5)
except:
    pass

display(HTML(htmlContent))

## adds the HF radar tile layers
jd_now = dt.datetime.utcnow()
map.add_tile_layer(
    tile_name='hfradar 2km',
    tile_url=
    'http://hfradar.ndbc.noaa.gov/tilesavg.php?s=10&e=100&x={x}&y={y}&z={z}&t='
    + str(jd_now.year) + '-' + str(jd_now.month) + '-' + str(jd_now.day) +
    ' ' + str(jd_now.hour - 2) + ':00:00&rez=2')

map.add_layers_to_map()

inline_map(map)

# <codecell>
    # get the station data from the sos end point
    name = stations[n]
    longname = obs_df[n].name
    lat = obs_lat[n]
    lon = obs_lon[n]
    popup_string = "<b>Station:</b><br>" + longname
    m.simple_marker([lat, lon], popup=popup_string)

    popup_string = "<b>Model Grid Point</b>"
    m.circle_marker(
        [model_lat[n], model_lon[n]], popup=popup_string, fill_color="#ff0000", radius=5000, line_color="#ff0000"
    )

m.line(get_coordinates(bounding_box, bounding_box_type), line_color="#FF0000", line_weight=5)

inline_map(m)

# <markdowncell>

# #### Plot Modeled vs Obs Currents

# <codecell>

# for df in model_df:
for n in range(len(obs_df)):
    ax = model_df[n].plot(figsize=(14, 6), title=model_df[n].name, legend=False)
    plt.setp(ax.lines[0], linewidth=3, color="0.7", zorder=1)
    ax.legend()
    #     ax.set_ylabel('Current speed m/s')

    # Overlay the obs data plot the first bin
            popupstring = "HF Radar: ["+ str(lat)+":"+str(lon)+"]" + "<br>for<br>" + ent['name']
            map.circle_marker([lat,lon], popup=popupstring, 
                              radius=1000,
                              line_color='#FF00FF',
                              fill_color='#FF00FF', 
                              fill_opacity=0.5)
                          
display(HTML(htmlContent))

## adds the HF radar tile layers
map.add_tile_layer(tile_name='hfradar 6km',
                   tile_url='http://hfradar.ndbc.noaa.gov/tilesavg.php?s=10&e=100&x={x}&y={y}&z={z}&t=2014-8-21 17:00:00&rez=6')
map.add_tile_layer(tile_name='hfradar 2km',
                   tile_url='http://hfradar.ndbc.noaa.gov/tilesavg.php?s=10&e=100&x={x}&y={y}&z={z}&t=2014-8-21 17:00:00&rez=2')
map.add_tile_layer(tile_name='hfradar 1km',
                   tile_url='http://hfradar.ndbc.noaa.gov/tilesavg.php?s=10&e=100&x={x}&y={y}&z={z}&t=2014-8-21 17:00:00&rez=1')
map.add_tile_layer(tile_name='hfradar 500m',
                   tile_url='http://hfradar.ndbc.noaa.gov/tilesavg.php?s=10&e=100&x={x}&y={y}&z={z}&t=2014-8-21 17:00:00&rez=0.5')


map.add_layers_to_map()

inline_map(map)  

# <codecell>


# <codecell>


예제 #4
0
        if 'SABGOM' in df.columns:
            kw = dict(popup=popup, marker_color="green", marker_icon="ok-sign")
        else:
            kw = dict(popup=popup, marker_color="green", marker_icon="ok")
    ssh.simple_marker(location=[obs['lat'], obs['lon']], **kw)

# Bad datum.
if isinstance(bad_datum, DataFrame):
    for station, obs in bad_datum.iterrows():
        popup = '<b>Station:</b> {}<br><b>Datum:</b> {}<br>'
        popup = popup.format(station, obs['datum'])
        kw = dict(popup=popup, marker_color="red", marker_icon="question-sign")
        ssh.simple_marker(location=[obs['lat'], obs['lon']], **kw)

ssh.create_map(path=os.path.join('ssh.html'))
inline_map('ssh.html')


# In[ ]:

elapsed = time.time() - start_time
log.info(elapsed)
log.info('EOF')


# ### Compute bias

# In[ ]:

import os
import sys
예제 #5
0
            m.simple_marker(location=[s["latitude"], s["longitude"]],
                            popup=popup_string)
        else:
            popup_string = ('<b>Not Enough Station Data for Num of years'
                            'requested</b><br><br>Num requested:' +
                            str(num_years_required) + '<br>Num Available:' +
                            str(len(s["data"].keys())) +
                            '<br><b>Station:</b><br>' + str(s['station_id']) +
                            "<br><b>Long Name:</b><br>" + str(s["long_name"]))
            add_invalid_marker(m, s, popup_string)

m.line(get_coordinates(bounding_box, bounding_box_type),
       line_color='#FF0000',
       line_weight=5)

inline_map(m)

# <markdowncell>

# ### Creates a time series plot with stations that have enough data

# <codecell>

# Set the random seed for consistency
np.random.seed(12)

fig, ax = plt.subplots()

# Show the whole color range
for s in station_list:
    if "data" in s:
     for line, name in zip(ax.lines, labels)]

    html = 'station_{}.html'.format(station)
    save_html(fig, '{}/{}'.format(run_name, html))
    plt.close(fig)

    popup = "<div align='center'> {} <br><iframe src='{}' alt='image'"
    popup += "width='{}px' height='{}px' frameBorder='0'></div>"
    popup = popup.format('{}'.format(sta_name), html,
                         (width*resolution)+75, (height*resolution)+50)
    kw = dict(popup=popup, width=(width*resolution)+75)

    if (df.columns == 'OBS_DATA').all():
        kw.update(dict(marker_color="blue", marker_icon="ok"))
    else:
        kw.update(dict(marker_color="green", marker_icon="ok"))
    obs = all_obs[all_obs['station'].astype(str) == station].squeeze()
    mapa.simple_marker(location=[obs['lat'], obs['lon']], **kw)


# ### Map

# In[7]:

from utilities import inline_map


mapa.create_map(path=os.path.join(run_name, 'mapa.html'))
inline_map(os.path.join(run_name, 'mapa.html'))

예제 #7
0
                                "<br><b>Long Name:</b><br>" +
                                str(s["long_name"]))
                add_invalid_marker(m, s, popup_string)
    else:  # If its a model station.
        if "latitude" in s:
            popup_string = ('<b>Station:</b><br>' + str(s['station_id']) +
                            "<br><b>Long Name:</b><br>" + str(s["long_name"]))
            m.simple_marker([s["latitude"], s["longitude"]],
                            popup=popup_string)

# Create the map and add the bounding box line
m.line(get_coordinates(bounding_box, bounding_box_type),
       line_color='#FF0000', line_weight=5)

# Show map of results.
inline_map(m)

# <markdowncell>

# ### Creates a time series plot only showing stations that have enough data

# <codecell>

# Set the random seed for consistency
np.random.seed(12)

fig, ax = plt.subplots(1)

# Show the whole color range
for s in station_list:
    if "data" in s:
        if 'SABGOM' in df.columns:
            kw = dict(popup=popup, marker_color="green", marker_icon="ok-sign")
        else:
            kw = dict(popup=popup, marker_color="green", marker_icon="ok")
    ssh.simple_marker(location=[obs['lat'], obs['lon']], **kw)

# Bad datum.
if isinstance(bad_datum, DataFrame):
    for station, obs in bad_datum.iterrows():
        popup = '<b>Station:</b> {}<br><b>Datum:</b> {}<br>'
        popup = popup.format(station, obs['datum'])
        kw = dict(popup=popup, marker_color="red", marker_icon="question-sign")
        ssh.simple_marker(location=[obs['lat'], obs['lon']], **kw)

ssh.create_map(path=os.path.join('ssh.html'))
inline_map('ssh.html')

# In[ ]:

elapsed = time.time() - start_time
log.info(elapsed)
log.info('EOF')

# ### Compute bias

# In[ ]:

import os
import sys
root = os.path.abspath(os.path.join(os.getcwd(), os.pardir))
sys.path.append(root)