markusfoote / mag1c

Other
29 stars 9 forks source link

Questions of scaling factors #3

Closed zxdawn closed 1 year ago

zxdawn commented 1 year ago

@markusfoote Hi, Markus. It's nice to see you open the code. I have one question about two scaling factors in your code. The first one is https://github.com/markusfoote/mag1c/blob/8b9ceae186f4e125bc9f628db82f41bce4c6011f/mag1c/mag1c.py#L243 Why do you need to scale the slope?

The second one is scaling the matched filter result: https://github.com/markusfoote/mag1c/blob/8b9ceae186f4e125bc9f628db82f41bce4c6011f/mag1c/mag1c.py#L150

If I understand correctly, the unit of matched filter should be ppm-m. If the not-scaled result's unit is ppp-m, then the scaling factor should be 1e6. So, my guess seems wrong ...

BTW, I want to get the unit of ppb, I come up with mf/500*1e6, because the uniform CH4 layer is 500m. However, the magnitude seems wrong and I need to multiply it by 5 to get the correct result. I suppose the scaling factor is the key for this problem.

Thank you for your time and consideration. Xin

HeQinWill commented 1 year ago

The scaling factor here seems to be for ensuring numerical stability, otherwise the values of the unit absorption spectrum s $(ppm \cdot m)^{-1}$ would be too small, not for the purpose of unit conversion.

To simplify, just use $L≈L_0-\alpha (\mu\odot s)$ to illustrate, the scaled result $(ppm \cdot m)$ we get after scaling s is: $$\alpha^{\prime} =\frac{L_0-L}{\mu \odot (scale \times s)} = \frac{1}{scale} \frac{L_0-L}{\mu \odot s}$$ so it need mf = torch.mul(mf, scaling, out=mf) in the end to get the actual result: $\alpha = scale \times \alpha^{\prime}$.

zxdawn commented 1 year ago

@HeQinWill Thank you for your clear explanation, Qin! It helps me a lot. Could you clarify whether the scaling factor can be any large value?

Additionally, I would like to confirm whether my method of converting units to ppb is accurate.

HeQinWill commented 1 year ago
  1. I think yes, as long as the scaling factor remains consistent.
  2. For the conversion issue, α should be divided by the path length (m) and then multiplied by 1000 (1 ppm=1000 ppb) to get ppb.

I noticed several papers set the path length as 8000 m, but I have recently been pondering how to consider this value properly.

zxdawn commented 1 year ago

@HeQinWill Actually, the README file of LUT dataset on this website says:

Background concentrations of CH4 and CO2 were set to 1.85 ppm and 
410.0 ppm, respectively, and used to scale the entire column of each greenhouse gas. CH4 and 
CO2 enhancements were added to a uniform layer from 0 to 500 m above the ground. For example, 
a CH4 enhancement of 1000 ppm·m would be simulated as a 2 ppm increase above background, with 
the concentration within the 500 m layer equaling 3.85 ppm.

However, /500*1e3 doesn't give me the correct magnitude of CH4.

HeQinWill commented 1 year ago

Based on my limited understanding, the enhancement of 2, 4, and 6 ppm within 500 meters is only for the forward calculation to obtain the unit absorption coefficient spectrum. Therefore, the inversion results in the concentration-path-length enhancement. It's actually difficult to convert it to XCH4 because the actual plume height of methane is unknown.

Certainly, some articles do mention the heights they assume:

To translate this into a total column average, denoted XCH4, for a scale height of about 8km [Thorpe et al., 2014], we simply multiplied the mixing ratio length by 0.000125 m−1. For example, 10,000 pp⋅mm translated to an XCH4 enhancement of 1.25ppm. The matched filter uses this unit absorption spectrum to convert changes in radiance into ΔCH4 in ppm·m units. Assuming a scale height of 8 km, 10,000 ppm·m translate to a ΔCH4 of 1.25 ppm (24).

If considering the actual height to be 500 meters, then using a 2 ppm interval in the simulation seems rather high. If I have misunderstood anything, I would appreciate it if you could kindly let me know.

Additionally, it seems that there's no need for this conversion if the goal is to calculate emissions flux using IME. Please check 2.5. Gas enhancement retrieval and integrated mass enhancement

zxdawn commented 1 year ago

Ha, thanks, your explanations sound reasonable. Then, we can create our own LUT using ppm instead of ppm·m. That would be easier to get XCH4.

CGrookie commented 9 months ago

Dear experts, could you please provide testing data on this code? I would like to test this project