-
Notifications
You must be signed in to change notification settings - Fork 5
Use dataframe #16
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: master
Are you sure you want to change the base?
Use dataframe #16
Conversation
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.
Just two remarks. Very good idea to move from numpy array to pandas dataframe.
When we first write this code, pandas did not exist
src/alinea/pyratp/runratp.py
Outdated
@staticmethod | ||
def DoAll(*args): | ||
ratp = pyratp.ratp | ||
pyratp.dir_interception.scattering = False | ||
ratp.out_time_spatial = np.zeros(pyratp.micrometeo.nbli*pyratp.grid3d.nveg*22*pyratp.grid3d.nent).reshape(pyratp.micrometeo.nbli*pyratp.grid3d.nveg*pyratp.grid3d.nent,22) | ||
ratp.out_time_tree = np.zeros(pyratp.micrometeo.nbli*8*pyratp.grid3d.nent).reshape(pyratp.micrometeo.nbli*pyratp.grid3d.nent ,8) | ||
ratp.out_time_spatial = np.zeros((pyratp.micrometeo.nbli * pyratp.grid3d.nveg * pyratp.grid3d.nent, 22)) |
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.
Replace 22 by len(columns).
And 8 by len(columns_tree).
Otherelse it is cryptic: Is 8 refers to 8 bytes... it takes me some seconds to figure out what 22 and 8 means.
src/alinea/pyratp/runratp.py
Outdated
|
||
@staticmethod | ||
def DoIrradiation(*args): | ||
ratp = pyratp.ratp | ||
ratp.out_rayt = np.zeros(pyratp.micrometeo.nbli*pyratp.grid3d.nveg*9*pyratp.grid3d.nent).reshape(pyratp.micrometeo.nbli*pyratp.grid3d.nveg*pyratp.grid3d.nent ,9) | ||
ratp.out_rayt = np.zeros((pyratp.micrometeo.nbli * pyratp.grid3d.nveg * pyratp.grid3d.nent, 9)) |
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.
Here, what 9 means?
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.
no idea, I just took the opportunity of this branch to change a reshape by directly passing the shape to np.zeros :)
But I'll investigate
I also left the code that write an output file in a temporary directory. The same code has been commented in in DoIrradiance. Shall we comment it too? |
Used a DEBUG constant and moved the code in a separate function as a pis-aller |
pandas was already a dependency :)