natashabatalha / picaso

A Planetary Intensity Code for Atmospheric Spectroscopy Observations
https://natashabatalha.github.io/picaso
GNU General Public License v3.0
69 stars 42 forks source link

Virga cld output ordering for climate runs #188

Closed natashabatalha closed 9 months ago

natashabatalha commented 9 months ago

Bug identified by @james-mang

Fix description:

Historically, virga just output “g,opd,ssa” always on the same grid, increasing wavenumber. If you run this line with full_output=False: https://github.com/natashabatalha/picaso/blob/4d907355da9e1dcca36cd053a93ef6112ce08807/picaso/justdoit.py#L5364 It just gives you those things, with no context (no wavelength, pressure grid etc). Those were our historical 196 cld files. Then we added in the option to get better output and that is when the as_dict option was born and I also made picaso_formatmore explicit to handle the pressure and wavenumber inputs. I have no encountered the problem because for retrievals recently I have swapped out the 196 grid and use my own custom wavelength grid so I always go through that picaso_format function. See how when you go through this way you explicitly add the wave output. The reason this is important is because wave is set by your .mieff file.

Two changes we can implement:

  1. change all instances of picaso_format in the code to this vj.picaso_format(opd, w0, g0, pressure = pres, wavenumber=wno) This is an easy fix as it just requires adding as_dict=True to all calls to virga, then adding these lines. I like this fix because then cld_output would be returned with pressure and wavelength information which is so needed.
  2. add a fix in virga to sort wavelength first so that things always get sorted at the onset
James-Mang commented 9 months ago

Recent commit in climate_cldoutput branch addresses change #1. I didn't remove as_dict from virga as a whole in case there are different combinations of virga versions being used (ie. master vs dev) but as_dict = True for all calls to virga within picaso.

There are two new outputs for cloudy climate runs. 'cld_output' is now 'cld_output_picaso' which includes pressure and wavelength information to be used to generate spectra. The second id 'virga_output'. I've wanted to do this for a while so now virga justplotit tools can be easily used.

James-Mang commented 9 months ago

Second commit includes changes to allow cloud runs with disequilibrium chemistry.

To address proposed fix #2, I've initiated a pull request in the virga repo to include a check on the wavelength grid order in the dev branch

natashabatalha commented 9 months ago

Also merged PR in Virga to dev so will close this!