fnemina / pyOSOAA

pyOSOAA is a python interface for the Ocean Successive Orders with Atmosphere - Advanced (OSOAA) radiative transfer.
GNU General Public License v3.0
20 stars 6 forks source link

Why not add the function to output Q & U ? #37

Closed Tianfeng-Pink closed 2 years ago

Tianfeng-Pink commented 3 years ago

We know that the polarization component is becoming more and more important in the study of atmospheric radiative transport, so why not add the function of the output polarization component Q and U respectively? (There seem to be "OSOAA.ResFile.Adv.Up" in the OSOAA code that output Q and U.)

fnemina commented 3 years ago

Hello Tianfeng-Pink. This is already implemented, by setting up the variable s.results.advup you can tell the OSOAA to generate this file. Here is a minimal example of how to generate this kind of output and plot it

import numpy as np
import matplotlib.pyplot as plt
import pyOSOAA

# Config OSOAA
s = pyOSOAA.OSOAA()
s.level = 1
# Set up this variable to obtavion 
# advup file
s.results.advup = "resadvup.txt"
s.run()

# Extact the values
level = s.outputs.advup.level
I = s.outputs.advup.I
Q = s.outputs.advup.Q
U = s.outputs.advup.U
vza = s.outputs.advup.vza

# Filter and plot them
idx = level==0
plt.plot(vza[idx],I[idx],label="I")
plt.plot(vza[idx],Q[idx],label="Q")
plt.plot(vza[idx],U[idx],label="U")

plt.xlabel("View zenith angle")
plt.ylabel("Stokes vector")

plt.legend()

plt.show()

here is a list of all the attributes of s.results and their default value, if you set them to a string a file will be created with that name and the corresponding OSOAA output file, as well as loaded into the python object in s.outputs.

profileatm = None
profilesea = None
aer = None
phyto = None
mlp = None
angrad = None
angmie = None
sosbin = None
vsvza = None
advup = None
advdown = None
advphi = None
vsz = "resfile_vsz.txt"

For the special case of advphi, this is a non standard output that need a modified version of OSOAA, you can find it in my repos. This generates the same file as the advup, but for differente acimut angles not for different levels.

Hope this works for you, Fran

Tianfeng-Pink commented 3 years ago

Wow, That's great. Thanks a lot! ^_^ In fact, I have been worried about how to simplify the OSOAA model to the radiation transfer model of single scattering recently. Is there any way to convert the OSOAA model to the single scattering model?

fnemina commented 3 years ago

I believe it depends on what properties you are trying to extract. If you are looking for the single scattering albedo, phase function and extinction coefficient, the values extracted from OSOAA are all the single scattering ones. From there you can calculate for example the single scattering reflectance (check Gordon-Wang 1994).

If you want to do simulations in the single scattering regime, the only parameters I've found that constrols that is SOS.IGmax. According to the manual it's the "maximal order of atmospheric and sea scattering & surface reflexion/transmission". You can access it in pyOSOAA as s.sos.igmax, the default value is hard coded to be 100 hundred.

I guess you can lower this value to 1 and that would give you the single scattering approximation, however I have never used it so you should check with CNES personal responsable for the OSOAA to confirm this.

Tianfeng-Pink commented 3 years ago

So kind of you. I will check with CNES and reply to you if it works.