register_matplotlib_converters()

fig, axes = plt.subplots(2, 1, figsize=(50, 200), sharex=False)

x_start, x_end = [], []

frac_h = 1 / 20

for name, ax in zip(['Riederalp', 'Pian Segno'], axes):
    if name == 'Riederalp':
        maxh = 11
        lyrtet = data.lyrtet_riederalp.copy()
        loc = srst.loc_astral(name,
                              'Valais',
                              46.38807,
                              8.03235,
                              elevation=2200)
    elif name == 'Pian Segno':
        maxh = 11
        lyrtet = data.lyrtet_lucomagno.copy()
        loc = srst.loc_astral(name,
                              'Ticino',
                              46.52078,
                              8.84335,
                              elevation=1900)
    start = lyrtet['DATETIME'].iloc[0].date()
    end = lyrtet['DATETIME'].iloc[-1].date() + dt.timedelta(days=2)
    x_start.append(start)
    x_end.append(end)
    x = np.arange(start, end, dt.timedelta(days=1)).astype(dt.datetime)
imax_min=len(y_mins)-1

# devices=['LM1']

for dev in devices:

    # Put the data of this device into data_dev
    data_dev=data.loc[data['DEVICE']==dev].copy()

    # Create the loc_astral object (see sunriseset.py) in order to calculate sunrise and dawn later on
    place=data_dev[['LUCOMAGNO','RIEDERALP']].iloc[0]
    coord=data_dev[['LATITUDE','LONGITUDE']].iloc[0]
    name=place.loc[place].index[0].capitalize()
    loc=srst.loc_astral(
        name,region[name],
        coord['LATITUDE'],
        coord['LONGITUDE'],
        elevation=2300
    )

    # Get the recording start and end times, letting empty values not set
    starts=pd.to_datetime(intervals.loc[dev+'_start'],format='%H:%M',errors='coerce')
    ends=pd.to_datetime(intervals.loc[dev+'_end'],format='%H:%M',errors='coerce')

    # Refeernce them to minute value
    starts=(starts.dt.hour.astype(int,errors='ignore')*60+starts.dt.minute.astype(int,errors='ignore')+starts.dt.second.astype(float,errors='ignore')/60)
    ends=  (ends.dt.hour.astype(int,errors='ignore')*60+ends.dt.minute.astype(int,errors='ignore')+ends.dt.second.astype(float,errors='ignore')/60)


    fig, ax = plt.subplots(1, 1,figsize=figsize,dpi=dpi)

示例#3
0
cf=None

if type(call_filter) is str and call_filter!='':
    cf=call_filter.upper().replace(" ","_")
    if cf in data.columns:
        data=data.loc[data[cf]>0]

if cf is None:
    cf = 'INDIVIDUALS'



for name, ax in zip(['Riederalp','Lucomagno'], axes):
    if name=='Riederalp':
        loc=srst.loc_astral(name,'Valais',46.39536, 8.04805, elevation=2300)
    elif name=='Lucomagno':
        loc=srst.loc_astral(name,'Ticino',46.55321, 8.78278, elevation=2300)

    lagmut=data.loc[data[name.upper()]].copy()

    start=lagmut['DATETIME'].iloc[0].date()
    end=lagmut['DATETIME'].iloc[-1].date()+dt.timedelta(days=2)
    x_start.append(start)
    x_end.append(end)
    x=np.arange(start, end, dt.timedelta(days=1)).astype(dt.datetime)

    lagmut['FRAC_HOUR']=lagmut['HOUR'].astype(float)+(lagmut['DATETIME'].dt.minute/(60*frac_h)).astype(int)*frac_h


    y=np.arange(hstart,hend,step=frac_h)