channels_list.append(channel)
        
        
        station = Station(stat, lat, lon, elev, channels=channels_list, 
                      site=site, vault=None, 
                      geology=None, equipments=None,
                      operators=None, 
                      creation_date=starttime, termination_date=endtime,
                      total_number_of_channels=None,
                      selected_number_of_channels=None, description=None,
                      comments=None, start_date=starttime, end_date=starttime,
                      restricted_status=None, alternate_code=None,
                      historical_code=None, data_availability=None)  
    
    station_list.append(station)

print network_code

network = Network(network_code, stations=station_list, total_number_of_stations=None, 
                  selected_number_of_stations=None, description=None, 
                  comments=None, start_date=None, end_date=None, 
                  restricted_status=None, alternate_code=None, 
                  historical_code=None, data_availability=None)

net_list = [network]
                  
inv = Inventory(net_list, 'IESE Ltd.')
print inv
inv.write(os.path.join(STATIONXML_DIR, '{}_network.xml').format(network_code), 
          'STATIONXML')
        loc_code = '00'
        depth = 0.0
        channel = Channel(chan, loc_code, lat, lon,
                          elev, depth)
        channels_list.append(channel)
               
    station = Station(stat, lat, lon, elev, channels=channels_list, 
                      site=site, vault=None, 
                      geology=None, equipments=None,
                      operators=None, 
                      creation_date=starttime, termination_date=endtime,
                      total_number_of_channels=None,
                      selected_number_of_channels=None, description=None,
                      comments=None, start_date=starttime, end_date=starttime,
                      restricted_status=None, alternate_code=None,
                      historical_code=None, data_availability=None)  
    
    station_list.append(station)


network = Network(network_code, stations=station_list, total_number_of_stations=None, 
                  selected_number_of_stations=None, description=None, 
                  comments=None, start_date=None, end_date=None, 
                  restricted_status=None, alternate_code=None, 
                  historical_code=None, data_availability=None)

net_list = [network]
                  
inv = Inventory(net_list, 'IESE Ltd.')
print inv
inv.write('{}_network.xml'.format(network_code), 'STATIONXML')