openradar / xradar

A tool to work in weather radar data in xarray
https://docs.openradarscience.org/projects/xradar
MIT License
98 stars 17 forks source link

CfRadial1 reader kwargs refactor, add to_cfradial2 exporter #49

Closed kmuehlbauer closed 1 year ago

kmuehlbauer commented 1 year ago
  1. CfRadial1 reader kwarg refactor:
"""
    first_dim : str
        Can be ``time`` or ``auto`` first dimension. If set to ``auto``,
        first dimension will be either ``azimuth`` or ``elevation`` depending on
        type of sweep. Defaults to ``auto``.
    optional : bool
        Import optional mandatory data and metadata, defaults to ``True``.
    site_coords : bool
        Attach radar site-coordinates to Dataset, defaults to ``True``.
"""
swp = xr.open_dataset(fname, group="sweep_0", site_coords=False, optional=False, first_dim="time", engine="cfradial1")

These kwargs are available for DataTree loading, as well as Dataset-loading.

  1. Add to_cfradial2 export function
    • added functionality to model to conform a sweep dataset, such that only CfRadial2 conforming data is written (needs extension and enhancement)

Todo: Add tests for the introduced functionality.

closes: #48

This PR also updates pre-commit hooks:

- add nbstripout, to clean notebooks before committing - remove the double-quote-string-fixer, as it contradicts with black-formatting - remove the skip-string-normalization from black-formatting - format with black

I can split this into two, if necessary. Need to make sure to do rebase-merge otherwise. This part moved to #50

codecov[bot] commented 1 year ago

Codecov Report

Merging #49 (e3a7cb6) into main (2aab4dc) will decrease coverage by 0.20%. The diff coverage is 73.77%.

@@            Coverage Diff             @@
##             main      #49      +/-   ##
==========================================
- Coverage   85.61%   85.41%   -0.21%     
==========================================
  Files          15       17       +2     
  Lines        3079     3119      +40     
==========================================
+ Hits         2636     2664      +28     
- Misses        443      455      +12     
Flag Coverage Δ
unittests 85.41% <73.77%> (-0.21%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
xradar/io/export/cfradial2.py 34.78% <34.78%> (ø)
xradar/model.py 94.25% <95.00%> (+0.09%) :arrow_up:
xradar/io/backends/cfradial1.py 88.02% <100.00%> (+2.12%) :arrow_up:
xradar/io/export/__init__.py 100.00% <100.00%> (ø)
xradar/io/export/odim.py 95.04% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

kmuehlbauer commented 1 year ago

PR docs

mgrover1 commented 1 year ago

@kmuehlbauer I think we can go ahead and merge this

kmuehlbauer commented 1 year ago

Yes, we can add anything I forgot in follow up PR's.