zxdawn / S5P-LNO2

Core code for the TROPOMI lightning NO2 retrievals
GNU General Public License v3.0
2 stars 1 forks source link

Accurate delta time between lightning and TROPOMI overpass #62

Closed zxdawn closed 1 year ago

zxdawn commented 1 year ago

We calculate the mean time as overpass time for our Arctic region

https://github.com/zxdawn/S5P-LNO2/blob/95d2f3e05ee1c715da60e82264fab94eade09560/main/s5p_lno2_utils.py#L103-L104

and then select lightning happened before that mean time

https://github.com/zxdawn/S5P-LNO2/blob/95d2f3e05ee1c715da60e82264fab94eade09560/main/s5p_lno2_utils.py#L140-L145

This could lead to missing lightning because the mean time is not the mean time over the convection region.

zxdawn commented 1 year ago

Note that this is also related to #61 which calculates the advection time

Although I noticed that we need to re-calculate the delta since the overpass time is updated in s5p_lno2_product.py.

https://github.com/zxdawn/S5P-LNO2/blob/95d2f3e05ee1c715da60e82264fab94eade09560/main/s5p_lno2_pe_lifetime.py#L96-L105

https://github.com/zxdawn/S5P-LNO2/blob/95d2f3e05ee1c715da60e82264fab94eade09560/main/s5p_lno2_product.py#L242-L245

zxdawn commented 1 year ago

Solution

Because the TROPOMI can fly over the Arctic within 10 minutes, we can add a 15-min tolerance in

https://github.com/zxdawn/S5P-LNO2/blob/95d2f3e05ee1c715da60e82264fab94eade09560/main/s5p_lno2_utils.py#L140-L145

subset = (-cfg['delta_time'] < df_lightning['delta']) & (df_lightning['delta'] < 15)

And, we need to update the delta immediately after recalculating the overpass time over convection:

https://github.com/zxdawn/S5P-LNO2/blob/95d2f3e05ee1c715da60e82264fab94eade09560/main/s5p_lno2_product.py#L242-L245

ds_lightning['delta'][:] = (ds_lightning_t1['time'] - t_overpass) / np.timedelta64(1, 'm')
ds_lightning = ds_lightning.where(ds_lightning['delta']<=0, drop=True)

Then, we can use the delta directly in production efficiency calculation instead of recalculating again

https://github.com/zxdawn/S5P-LNO2/blob/95d2f3e05ee1c715da60e82264fab94eade09560/main/s5p_lno2_pe_lifetime.py#L96-L105