-
Notifications
You must be signed in to change notification settings - Fork 27
Use SI units for internal computations #735
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
Draft
SouthEndMusic
wants to merge
21
commits into
master
Choose a base branch
from
internal_SI_units
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue addressed
Fixes #326
Explanation
My apologies for the bloated PR. Here's an overview of what I did.
Units
units.jlis a new script which describes unit behavior. It defines theUnitobject, and as well as:UnitobjectSIunitsBMIstandardstandard_name.jl, which is now subdivided into 4 files as the amount of data in this file was getting quite large:standard_name_sbm.jlstandard_name_domain.jlstandard_name_routing.jlstandard_name_sediment.jlget_atset_states!ncreadrainfall_erosion_eurosem).write_csv_rowwrite_netcdf_timestepBMI.get_var_unitsnow returns SI units, as the internal arrays which are accessed through the BMI are expressed in SI unitsThe timestep unit made this PR quite tricky. That is because in many places rates (something per timestep) was implicitly converted to amounts (something), which was possible because the conversion factor is then 1, but it makes for hard to understand code unit-wise.
Others
@infomessages for initialized data withprettytables.jl. See the functionto_table. Here's an example:n. These can easily be replaced by the constructors generated by@with_kwamountin the sediment module into more descriptive ones (soil_erosion_rate,sediment_rate,sediment_transport_capacity)InputEntryfor IO convenience, but I ultimately decided against it. During this process I did come up with a simplified interface to modify to config:Final notes
Checklist
master