network_start_end = False # go through station start/end date dict and get the overall start_end date for key, (start, end) in station_start_end_dict.iteritems(): if not network_start_end: network_start_end = [start, end] continue if start < network_start_end[0]: network_start_end[0] = start elif end > network_start_end[1]: network_start_end[1] = end # now add the network start/end date net_inv.start_date = UTCDateTime(network_start_end[0]) net_inv.end_date = UTCDateTime(network_start_end[1]) # print(net_inv) #add the network inventory to the complete and updated inventory new_inv.networks.append(net_inv) XML_file = join(XML_path_out, FDSNnetwork+'_updated.xml') if exists(XML_file): remove(XML_file) # write the inventory into the default path new_inv.write(path_or_file_object=XML_file, format='STATIONXML', validate=True) # add it to ASDF file