-
Notifications
You must be signed in to change notification settings - Fork 0
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
Julia function for processing Equation file. #2
Comments
Equations can span multiple lines according to KPP files. Therefore, in python version, it read the whole equation file at once. |
Code different between Python and Julia: |
In Python, the scope of a variable declared within a try block extends to the entire function or module, even if the variable is assigned a value within the try block. eg: PyBox variable: stoich (Python does not have block-level scope for variables) In Julia, variables declared inside a try block are scoped to that block. If you want a variable declared inside a try block to be accessible outside of it, you need to declare the variable before the try block. |
Julia don't have 'collections.defaultdict()' to create a 'collect' with default value. Therefore there is a big change of this this python code: In Julia, we need to use haskey() to check if there is an entry for the given key of the outter dictionary, and if not, we need to create one along with an inner dictionary. We apply similar checking to the inner dictionary to exam the: equatoin_step Another way to do the smiliar logic is using build-in function: get!(f::Union{Function, Type}, collection, key): |
Python's regx has findall() function. However, Julia doesn't has the same thing. |
Question:
|
Pyhton has defaultdict(), eg: {0: defaultdict(None, {0: 'BCARY', 1: 'NO3'})} There is a library called: DataStructures.jl, that allows specification of a default value to return when a requested key is not in a dictionary. |
Basic Project structure:
|
Create a unit test case to test the parse equation function
|
Make sure we can read the equation files into a Julia program
The text was updated successfully, but these errors were encountered: