-
Notifications
You must be signed in to change notification settings - Fork 10
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
Cleaning up codebase and restructuring OpticalThickness calculation #17
base: master
Are you sure you want to change the base?
Conversation
…e spectral line loading to before the loop in optical thickness calc
@ddbkoll I think you're correct about speeding up the On that note though, could you explain what's happening towards the end of
|
abs = Sgam/(math.pi( dn2 + gam2)) absGrid[i1:i2] += abs The rest is just setting up a temporary wavegrid dn which is centered on the line center, doesn't run out of the bounds of the overall waveGrid (hence the min/max), and goes "nWidths*gam" cm-1 out away from the line center. |
Ok, thanks! That makes it a lot clearer now. Under what conditions would I'll have a think about whether it's feasible to use numpy to remove the loop in this function, might be a bit tricky/memory intensive to set up all of the temporary wavegrids at once though. |
This PR fixes a couple of the issues in #16 related to unused code and global instances.
Changes:
use_numba
option deprecated. I think it might be possible to fix it in future, but for now the numba functionality certainly is not robust.Lots of tidying in
Absorption_Crosssections_HITRAN2016
:ClimateUtilities
import, addedimport numpy
insteadQGenericLin
andQGenericNonLin
have been replaced with one function which takes the power law exponent as an input. I've made this exponent part of themolecules
dictionary which is defined near the top.global
instances removed! This makes the code much more readable and easy to debug, and also is one step towards restoring thenumba
functionality, although not quite there yet...loadSpectralLines()
BEFORE the main loops inOpticalThickness.py
ClimateGraphics.py
,ClimateGraphics_MPL.py
,DummyGraphics.py
andClimateUtilities.py
phys.py
object_helpers.py
The tests all run okay, I'd recommend running them yourself on your platform first though and checking that you get the same numbers compared to the base version before merging, just as a sanity check! :)
Also, as far as the user is concerned there aren't any changes to the API either, it's just cleaner behind the scenes!