-
Notifications
You must be signed in to change notification settings - Fork 22
I-ALiRT - Update codice l2 #2501
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
base: dev
Are you sure you want to change the base?
I-ALiRT - Update codice l2 #2501
Conversation
greglucas
left a comment
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 have a few suggestions that I think might make this a little cleaner without all the case handlings.
-
Stick to numpy arrays. So try to initialize an empty array with the expected shape.
pseudo_density_arr = np.empty((len(constants.LO_IALIRT_VARIABLE_NAMES), len(intensity))
Then you can ignore the division by zero and let nan's fall out automatically and replace with fills later if you want. (remove all if 0 branches) -
Use an IntEnum for your species names. Then you can lookup into arrays with
pseudo_density_arr[LoSpecies.O_7_plus, :]rather thanpseudo_density_dict[species_list[3]]with kind of two redirects in there which is confusing for me to follow without looking back up what index is what in the species list.
| pseudo_density_dict[species_list[3]] | ||
| + pseudo_density_dict[species_list[4]] | ||
| + pseudo_density_dict[species_list[5]] |
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 thought I commented on this somewhere else earlier but couldn't find it immediately. I think this would be much easier to follow with an IntEnum to index into the named species.
class Species(IntEnum):
OXYGEN = 0
CARBON2 = 1
...
pseudo_density_arr[Species.OXYGEN]
Change Summary
Overview
Formatting to get codice_lo into a format that can be inserted into DynamoDB.
Updated Files
Testing