-
Notifications
You must be signed in to change notification settings - Fork 11
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
Updates for version 1.3 #33
Conversation
kanishkan91
commented
Oct 10, 2022
•
edited
Loading
edited
- Take out transition code to increase memory allocation
- Add parallelization for land type kernel density processing
- Add script to write ncdfs using xarray based on inputs in config file
- Add testing script for new users
- Make reading in region, basin mapping file parameterzied so users can read in their own region, basin mapping file
- Changes to code cov yml along with addition of badge.
- Changes to setup.py (New package dependencies, bumping up python version)
- Addition of demeter 1.3.1 workflow which accounts for all changes above.
- Adding new docs generated using sphinx
1. Take out transition code to increase memory allocation 2. Add parallelization for land type kernel density processing 3. Add post processing script to generate ncdf files corresponding to demeter runs with each LC as a subdata type 4. Add testing script for new users
1. Assign threads dynamically when applying convultion filter 2. Add ncdf_conversion to native demeter code base 3. Update mapping files for IM3 CLM team 4. Add xarray to setup
Codecov Report
@@ Coverage Diff @@
## main #33 +/- ##
==========================================
- Coverage 73.49% 70.02% -3.48%
==========================================
Files 17 18 +1
Lines 1343 1461 +118
==========================================
+ Hits 987 1023 +36
- Misses 356 438 +82
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
1. Adding code so that ncdfs can be generated endogenously by setting a constant in config file 2. Bumping up python version to 3.8 3. Adding documentation for handle_single_pft() function
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.
As a python amateur, I was able to successfully run demeter and view the outputs, as well as modify the spatial resolution and run it again. There were hiccups at the beginning due to package version issues, but those have been resolved by changing which package versions are required. Great work!
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.
Great job @kanishkan91! Just a few inline comments to see to.
Also, for the test data: let's stay away from pickled files and use parquet files instead. Pickled files carry version dependencies.
Thanks!
demeter/ncdf_conversion.py
Outdated
return ds | ||
|
||
|
||
if __name__ == "__main__": |
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.
Even though this code will only run from the target script, let's remove the direct call since we are in a package. So everything after 261 should go.
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.
Fixed. Thanks!
demeter/process.py
Outdated
@@ -57,7 +59,7 @@ def prep_step(self): | |||
self.s.weights, self.s.spat_ludataharm) | |||
|
|||
# create transition array to store data | |||
self.transitions = np.zeros(shape=(self.l_spat_region, self.l_order_rules, self.l_order_rules)) | |||
#self.transitions = np.zeros(shape=(self.l_spat_region, self.l_order_rules, self.l_order_rules)) |
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.
let's get rid of the commented code
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.
Fixed. Thanks!
demeter/process.py
Outdated
|
||
self.config.logger.info("Saving land cover transition files for time step {0}...".format(self.step)) | ||
# self.config.logger.info("Saving land cover transition files for time step {0}...".format(self.step)) |
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.
Remove commented code
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.
Fixed. Thanks!
demeter/process.py
Outdated
|
||
wdr.write_transitions(self.s, self.config, self.step, self.transitions) | ||
# wdr.write_transitions(self.s, self.config, self.step, self.transitions) |
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.
Remove commented code
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.
Fixed. Thanks!
demeter/process.py
Outdated
return wdr.lc_timestep_csv(self.config, self.step, self.s.final_landclasses, self.s.spat_coords, orig_spat_aez, | ||
self.s.spat_region, self.s.spat_water, self.s.cellarea, self.s.spat_ludataharm, | ||
self.config.metric, self.config.tabular_units, self.write_outputs) | ||
self.config.metric, self.config.tabular_units, self.write_outputs,write_ncdf,self.sce,self.res,write_csv,self.regrid_res) |
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.
to conform to Python's PEP8 style req, leave space after commas. E.g., write_ncdf, self.sce
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.
Fixed. Thanks!
@@ -0,0 +1,97 @@ | |||
|
|||
import xarray as x |
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.
import xarray using it's well known alias to avoid confusion: import xarray as xr
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 think this file itself is redundant since this has been functionalized. I'l take this out.
@@ -0,0 +1,97 @@ | |||
|
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.
import order of packages should follow PEP 8 style requirements (https://peps.python.org/pep-0008/#imports)
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 think this file itself is redundant since this has been functionalized. I'l take this out.
@@ -0,0 +1,9 @@ | |||
import demeter |
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.
same comment as above
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.
Fixed. Thanks
setup.py
Outdated
@@ -24,6 +24,7 @@ def readme(): | |||
'pandas~=1.2.4', |
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.
your requirements file has these versions pinned e.g., ==
, I prefer this method where >=
is used if possible.
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.
Fixed. Thanks!
@@ -31,6 +31,7 @@ jobs: | |||
pip install pandas==1.2.4 |
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.
see comment about pinning in setup.py
file review
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.
Fixed. Thanks!