-
Notifications
You must be signed in to change notification settings - Fork 2
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
68 smrf integration #81
Conversation
…the variables, working through consolidating the duplicated code to track down why
… converting smrf to 32 bit and back
|
""" | ||
Takes values from the queue and uses them to run iPySnobal | ||
""" | ||
def _only_for_testing(self, data): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am torn on this. Did you try to do the casting and then comparison in the test suite with a helper method?
If possible I tend to approach testing specific issues this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a huge fan of this either... The problem is that the SMRF data needs to be converted before running pysnobal. Therefore, it has to happen within AWSM and not in testing. Or we do all calculations in 32-bit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What downside would a 32-bit calculation have? I could not think of any for the current
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The one downside I see is that numpy is 64-bit by default. The main problem is that iSnobal C code expects double so it'll have to be converted at some point. So a potential solution would be to have an option to do single or double precision and keep everything at 32-bit for testing.
Might actually be able to pull this off within netcdf. It appears that you can write 64-bit variable. I'll look into it but will require a new option for SMRF.
Focusing on a better integration of SMRF and Pysnobal to reduce code duplication. The old AWSM version had many things as just functions passing around an AWSM instance. This moves to a class based approach to house all the same functionality with expanded testing.
SMRFConnector
class to manage the connection between AWSM and SMRF. This can perform the standardrun_smrf
or keep a SMRF instance to fun specific timestepsPysnobal
class to manage the actual iSnobal simulations. There are 3 ways that this works, 1) reading netcdf files and running pysnobal, 2) runningsmrf_ipysnobal
that runs pysnobal after each SMRF timestep or 3)smrf_ipysnobal
threaded where pysnobal is added to the SMRF queue to get data from the queuepysnobal_io
is still there but will wait until Make netcdf files more verbose #41 and combining the files proposed in AWSM roadmap #71_only_for_testing
in Pysnobal. The gold files were created from SMRF output in NetCDF files which are 32-bit. When runningsmrf_ipysnobal
these are using the 64-bit values to run pysnobal which leads to float errors that are larger than I was comfortable with for assertion. Therefore this function that is only used in testing converts the data type to float32 then back to simulate writing to disk.This requires the SMRF PR #188 that adds better API functionality to SMRF.
Note: this overhaul is still a work in progress and some scripts like
run_awsm_daily
are broken.