Closed syedhamidali closed 1 year ago
@syedhamidali I've fixed an issue on main to get the CI started here. I'll have a closer look later today if no one beats me to it.
Merging #126 (e807122) into main (e10a697) will increase coverage by
0.10%
. The diff coverage is91.83%
.
@@ Coverage Diff @@
## main #126 +/- ##
==========================================
+ Coverage 88.21% 88.31% +0.10%
==========================================
Files 19 20 +1
Lines 3334 3431 +97
==========================================
+ Hits 2941 3030 +89
- Misses 393 401 +8
Flag | Coverage Δ | |
---|---|---|
unittests | 88.31% <91.83%> (+0.10%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
Files | Coverage Δ | |
---|---|---|
xradar/io/export/__init__.py | 100.00% <100.00%> (ø) |
|
xradar/model.py | 96.19% <100.00%> (ø) |
|
xradar/io/export/cfradial1.py | 91.66% <91.66%> (ø) |
So, @kmuehlbauer, could you please explain how Codecov works? My understanding is that we need to create some tests for it. However, I couldn't find any tests for to_cfradial2
, and I'm hesitant to make changes without a clear understanding of how it functions. I'd appreciate your assistance in this matter. Thank you!
@syedhamidali Currently we use the notebooks to test this. That's no full featured unittest as it just checks that it runs without raising an error.
We'd decided to add tests while touching the codebase.
Thank you for this info! So, what is the solution here?
OK, I can't give a very detailed answer now, but the idea would be to create some roundtrip tests first. Where we write and read back some predefined data and compare it against each other.
Finally, we would like to have tests for each function.
Check out this pull request on
See visual diffs & provide feedback on Jupyter Notebooks.
Powered by ReviewNB
@syedhamidali I've played a bit with it, this is really neat. Great work!
@kmuehlbauer I appreciate your help greatly! Your code served as an invaluable reference, and knowing that you’ll be there for assistance gave me the confidence to dive into it without any reservations. Thanks!
@syedhamidali Thanks, you're very welcome and I'm sure you will be a continuing contributor to xradar.
Do you think you can finalize the notebook until tomorrow?
@kmuehlbauer Notebook for the tests or for the example?
Good question, do you think it would make sense to combine it?
Separating them would be a better approach as it simplifies the user experience by not exposing the tests directly. Additionally, I attempted a this approach, and when we save it to cfradial1, the xarray does not preserve its mask. This discrepancy in the masking could be a potential reason for the lack of identity between the two datasets. What are your thoughts on this?
But this way it seems they are identical
OK, then I'd suggest an example notebook and unit tests under xradar/tests/io -> test_cfradial1.py.
You could use xr.testing.assert_identical(ds1, ds2) for testing.
OK, then I'd suggest an example notebook and unit tests under xradar/tests/io -> test_cfradial1.py.
You could use xr.testing.assert_identical(ds1, ds2) for testing.
I tried that one, check this out https://github.com/openradar/xradar/pull/126#issuecomment-1735514574, I feel that is masked_arrays/fill_value vs NaNs
xr.testing.assert_identical(dtree["sweep_0"].ds, dtree2["sweep_0"].ds)
xr.testing.assert_equal(dtree["sweep_1"].ds, dtree2["sweep_1"].ds)
xr.testing.assert_equal(dtree["sweep_2"].ds, dtree2["sweep_2"].ds)
Something like this works for me.
I attempted a this approach, and when we save it to cfradial1, the xarray does not preserve its mask. This discrepancy in the masking could be a potential reason for the lack of identity between the two datasets. What are your thoughts on this?
I think you can't write masked arrays to netcdf with xarray. You would need _FillValue
attribute in any case. Maybe I'm misunderstanding the issue.
@syedhamidali I think the roundtrip test is sufficient for now. Please let me know when this is ready for merge. There might be some clean-up needed in the CfRadial1 Notebook. Maybe we can have the release already tomorrow. :rocket:
I tried to make a notebook, but the problem is that I don't know yet how this datatree.DataTree
works and its documentation is also not clear enough. Would you like to take a look at this notebook and suggest your changes, so that I can just upload that to the notebooks? Here https://github.com/syedhamidali/test_scripts/blob/test/CfRadial1_Export.ipynb
@syedhamidali The notebook looks nice for the first setup, you can extend it any time by adding additional information to it.
Add it to the examples and we are almost ready to get this in.
Please also add an entry to docs/history.md!
Hello Kai,
Just a quick question before I run pre-commit, should I use tempfile generated filename, or just comment this xd.io.to_cfradial1 statement in the notebook
Just a quick question before I run pre-commit, should I use tempfile generated filename, or just comment this xd.io.to_cfradial1 statement in the notebook
Which notebook? If you mean your example notebook just keep the filename and write to the current directory.
OK, we are very close now @syedhamidali. There are minimal tweakings needed to hook the example notebooks at the proper place in the docs. I can do this work after merging this while preparing the release. WDYT? Shall we merge?
OK, we are very close now @syedhamidali. There are minimal tweakings needed to hook the example notebooks at the proper place in the docs. I can do this work after merging this while preparing the release. WDYT? Shall we merge?
Thank you, @kmuehlbauer, please go ahead whenever you're ready.
Thanks @syedhamidali, :+1: :100: !
Thanks for all your hard work here @syedhamidali !!
history.md
I have incorporated the CFRadial1 writer into the code and tested it with four different CFRadial1 data files. It successfully processed three of the files. While it currently works with full radar volumes, I acknowledge that further refinement and compatibility with sweeps are necessary. I welcome any suggestions for improvement and am open to any modifications that enhance its suitability.
I also ran
pre-commit run --all-files
.Thanks Hamid