Remove specific channel from an Inventory?

Hello obspy-users,
Is there a way to delete a single channel (as defined by its net.sta.loc.cha) from an Inventory object? Below is a minimal example that returns a list of 9 channels. Let’s say I want to modify the Inventory so it contains all of these channels except MM.MDY…HHZ. Can I “delete” a single channel from the inventory? Any other suggestions on how to accomplish this?
Thanks for your help!

Emily

from obspy.clients.fdsn import Client
client = Client(“IRIS”)

inv = client.get_stations(network=“MM”, channel=“HHZ”, level=“response”)

print(inv)

Inventory created at 2018-03-14T00:38:46.000000Z
Created by: IRIS WEB SERVICE: fdsnws-station | version: 1.1.32
http://service.iris.edu/fdsnws/station/1/query?network=MM&channel=H.
Sending institution: IRIS-DMC (IRIS-DMC)
Contains:
Networks (1):
MM
Stations (9):
MM.HKA (Haka, Chin, Myanmar)
MM.KTA (Katha, Myanmar)
MM.KTN (Keng Tun, Shan, Myanmar)
MM.MDY (Mandalay, Mandalay, Myanmar)
MM.NGU (Ngaung U, Myanmar)
MM.SIM (Sittwe, Rakhine, Myanmar)
MM.TGI (Taung Gyi, Myanmar)
MM.TMU (Tamu, Sagaing, Myanmar)
MM.YGN (Yangon, Yangon, Myanmar)
Channels (9):
MM.HKA…HHZ, MM.KTA…HHZ, MM.KTN…HHZ, MM.MDY…HHZ, MM.NGU…HHZ,
MM.SIM…HHZ, MM.TGI…HHZ, MM.TMU…HHZ, MM.YGN…HHZ

maybe one way would be to creating a new empty inventory and using old_inventory.select to fill the new one?

cheers,
blaž

Hi Emily,

I also needed something like that before, so I think we should add a
.remove() method to Inventory. I've opened a PR for it:

https://github.com/obspy/obspy/pull/2088

cheers,
T