# Response unit converting

**URL:** https://discourse.obspy.org/t/response-unit-converting/2104
**Category:** Usage Questions
**Created:** [November 21, 2024, 7:15am UTC](https://discourse.obspy.org/t/response-unit-converting/2104 "2024-11-21T07:15:36Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Dmitriy\_Gordienko](https://discourse.obspy.org/user_avatar/discourse.obspy.org/dmitriy_gordienko/32/846_2.png) [@Dmitriy\_Gordienko](https://discourse.obspy.org/u/Dmitriy_Gordienko)
#### Post date: [November 21, 2024, 7:15am UTC](https://discourse.obspy.org/t/response-unit-converting/2104/1 "2024-11-21T07:15:36Z")

</div>

Hello everyone!  
I use the following code to get the data:

```python
inventory = client.get_stations(network=net, station=sta, location=loc, channel=chan, starttime=starttime, endtime=endtime, level='response')
network = inventory[0]
station = network[0]
channel = station[0]
response = channel.response

```

Then I get the necessary response information from the stage:

```python
for stage in response.response_stages:
    poles = stage.poles
    zeros = stage.zeros
    ...

```

…

As I understand, the inventory object contains information about responses in displacement. But how can I get the recalculated information in velociti and acceleration and new sensitivity values?

Maybe I don’t understand something. My goal is to get the response I need in a format suitable for use in CSS3.0. I did this, but I need to understand exactly what units I’m working with and how I should convert.

My respons output format is:

> # 
> 
> theoretical 1 unknown paz IRIS-DMC  
> 4.3449281462e+17 1.0000000000e+00  
> 11  
> -3.6910000000e-02 3.7020000000e-02 0.0000000000e+00 0.0000000000e+00  
> -3.6910000000e-02 -3.7020000000e-02 0.0000000000e+00 0.0000000000e+00  
> -3.4300000000e+02 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00  
> -3.7000000000e+02 4.6700000000e+02 0.0000000000e+00 0.0000000000e+00  
> -3.7000000000e+02 -4.6700000000e+02 0.0000000000e+00 0.0000000000e+00  
> -8.3600000000e+02 1.5220000000e+03 0.0000000000e+00 0.0000000000e+00  
> -8.3600000000e+02 -1.5220000000e+03 0.0000000000e+00 0.0000000000e+00  
> -4.9000000000e+03 4.7000000000e+03 0.0000000000e+00 0.0000000000e+00  
> -4.9000000000e+03 -4.7000000000e+03 0.0000000000e+00 0.0000000000e+00  
> -6.9000000000e+03 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00  
> -1.5000000000e+04 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00  
> 6  
> 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00  
> 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00  
> -3.9200000000e+02 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00  
> -1.9600000000e+03 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00  
> -1.4900000000e+03 1.7400000000e+03 0.0000000000e+00 0.0000000000e+00  
> -1.4900000000e+03 -1.7400000000e+03 0.0000000000e+00 0.0000000000e+00  
> theoretical 2 unknown paz IRIS-DMC  
> 1.0000000000e+00 1.0000000000e+00  
> 0  
> 0  
> theoretical 3 unknown paz IRIS-DMC  
> 1.0000000000e+00 1.0000000000e+00  
> 0  
> 0  
> theoretical 4 unknown fir IRIS-DMC  
> 3.0000000000e+04 1  
> 1  
> 1.0000000000e+00 0.0000000000e+00  
> 0

Thanks for any help!

---

<div class="post-metadata">

### Author: ![megies](https://discourse.obspy.org/user_avatar/discourse.obspy.org/megies/32/9_2.png) [@megies](https://discourse.obspy.org/u/megies)
#### Post date: [November 21, 2024, 9:53am UTC](https://discourse.obspy.org/t/response-unit-converting/2104/2 "2024-11-21T09:53:55Z")

</div>

> [@Dmitriy\_Gordienko](#):
>
> As I understand, the inventory object contains information about responses in displacement.

The response object holds the info that is included in the source of the metadata. The response stages will themselves declare what units they are (input units + output units).

> [@Dmitriy\_Gordienko](#):
>
> My goal is to get the response I need in a format suitable for use in CSS3.0

There is write support for “CSS”, which I never used personally but it sounds like thats what you are looking for probably, even though it looks a bit different from that file example you posted there.

```python
inv = read_inventory()
inv.write('/tmp/metadata.txt', format='CSS')

```

> [@Dmitriy\_Gordienko](#):
>
> But how can I get the recalculated information in velociti and acceleration and new sensitivity values?

If you are looking for response values at certain frequencies, you could always query those in whatever units you need

```python
response = inv[0][0][0].response
response.get_evalresp_response_for_frequencies([0.01, 0.1, 1, 10, 100], output='ACC')
response.get_evalresp_response_for_frequencies([0.01, 0.1, 1, 10, 100], output='DISP')
response.get_evalresp_response_for_frequencies([0.01, 0.1, 1, 10, 100], output='VEL')

```

---

<div class="post-metadata">

### Author: ![Dmitriy\_Gordienko](https://discourse.obspy.org/user_avatar/discourse.obspy.org/dmitriy_gordienko/32/846_2.png) [@Dmitriy\_Gordienko](https://discourse.obspy.org/u/Dmitriy_Gordienko)
#### Post date: [November 21, 2024, 2:05pm UTC](https://discourse.obspy.org/t/response-unit-converting/2104/3 "2024-11-21T14:05:37Z")

</div>

Thanks for the answer!  
Unfortunately, the write-method does not create a response file and the metadata files I need (site/sitechan/instrument/sensor). This is written in the documentation. My goal is to create an analog of the rdseed Iris-program, which uses a datales file to create a pazfir response. I did it. However, I would like to be able to recalculate the response into the units I need and get the calib and calper (for wfdisc and sensor tables) values I need based on the new sensitivity and frequency values. Perhaps I am doing something wrong. I am not strong in this matter.
