Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add resort rebin capability to simple forward model calculation (outside of climate calculation) #231

Open
natashabatalha opened this issue Jan 23, 2025 · 0 comments

Comments

@natashabatalha
Copy link
Owner

natashabatalha commented Jan 23, 2025

Problem:

If user runs

#second the correlated k table
opacity_ck = jdi.opannection(ck=True,
                             ck_db=ck_db, deq=True, gasses_fly=[list of molecules...]
                            )

it would pull the HDF5 individual molecule opacity files BUT the code would break because opacityclass.molecular_opa is not defined

https://github.com/natashabatalha/picaso/blob/bfefda1ef78ea220b7cb8ae988d7f0b7fc53dd45/picaso/optics.py#L251C1-L256C41

The only two options here are to sum all the opacities when ngauss==1 and if there are gauss ck points it just sums the gauss opacities (does not take into account mixing ratios).

Code addition

In RetrieveCKs if deq=True:

class RetrieveCKs():

add:

self.gases_fly=gases_fly

Now go through function passing and eliminate gases_fly as an input variable to those functions. For example, get_opacities_deq_onfly and mix_my_opacities_gasesfly

Also eliminate bundle to Last, delete bundle as an input to get_opacities_deq_onfly and mix_my_opacities_gasesfly

Right now bundle is being used to get mixing ratios however, those are already in atmosphere class as :

atmosphere.layer['mixingratios']

so you can change these lines https://github.com/natashabatalha/picaso/blob/bfefda1ef78ea220b7cb8ae988d7f0b7fc53dd45/picaso/optics.py#L1150C1-L1152C75

to

        mixes = []
        df_atmo = atmosphere.layer['mixingratios'] #bundle.inputs['atmosphere']['profile']
        for imol in gases_fly: 
            mixes += [df_atmo[imol].values]
 

Then can add another piece to this elif statement:

if isisntance(opacityclass.gases_fly, list):
    get_opacities = opacityclass. get_opacities_deq_onfly 

Finally, do a grep on get_opacities_deq_onfly and mix_my_opacities_gasesfly and remove the gases_fly and bundle input throughout the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant