Skip to content

simplify generic I/O logic for cpx binary files#642

Merged
yunjunz merged 1 commit intoinsarlab:mainfrom
yunjunz:io
Aug 19, 2021
Merged

simplify generic I/O logic for cpx binary files#642
yunjunz merged 1 commit intoinsarlab:mainfrom
yunjunz:io

Conversation

@yunjunz
Copy link
Member

@yunjunz yunjunz commented Aug 19, 2021

Description of proposed changes

This PR modifies readfile/writefile to read and write complex binary files (from isce-2) directly in complex data type by default.

For plotting in view.py, which requires real data type, I add readfile.get_slice_list(no_complex) option to translate complex into mag/phase for plotting. This option is turn off by default for generic I/O.

  • readfile:

    • read_binary_file(): for "slc", set cpx_band to "complex" unless mag/phase is clearly specified.
    • get_slice_list(): 1) ignore meaningless geo/rdr file extension; 2) add "no_complex" arg to switch between complex (for I/O) and mag/phase (for plotting)
  • writefile:

    • write(): for .slc/.int, write complex directly
    • write_isce_xml(): add "image_type" arg to initiate different ISCE-2 image objects for better compatiability
    • write_isce_file(): support file_type == 'isce_slc'
    • comment out obsolete write_complex64() as write_complex_float32() is equivalent but simpler and faster.
  • subset/multilook: update usage of writefile.write_isce_xml()

  • view: update usage of readfile.get_slice_list()

Other minor changes:

  • subset.py: add --sub-x/y/lat/lon and --subset-x/y/lat/lon to be consistent with subset option names in other scripts.
  • view.py: add --nmli / --num-multilook for --multilook-num
  • simulation.simulation.py: typo fix and add missing wvl arg while calling timeseries2ifgram()
  • objects.sensor: typo fix for doppler_bandwidth

Reminders

  • Pass Codacy code review (green)
  • Pass Circle CI / local test (green)
  • Make sure that your code follows our style. Use the other functions/files as a basis.
  • If modifying functionality, describe changes to function behavior and arguments in a comment below the function declaration.
  • If adding new functionality, add a detailed description to the documentation and/or an example.

This PR modifies readfile/writefile to read and write complex binary files (from isce-2) directly in complex data type by default.

For plotting in view.py, which requires real data type, I add readfile.get_slice_list(no_complex) option to translate complex into mag/phase for plotting. This option is turn off by default for generic I/O.

+ readfile:
   - read_binary_file(): for "slc", set cpx_band to "complex" unless mag/phase is clearly specified.
   - get_slice_list(): 1) ignore meaningless geo/rdr file extension; 2) add "no_complex" arg to switch between complex (for I/O) and mag/phase (for plotting)

+ writefile:
   - write(): for .slc/.int, write complex directly
   - write_isce_xml(): add "image_type" arg to initiate different ISCE-2 image objects for better compatiability
   - write_isce_file(): support file_type == 'isce_slc'
   - comment out obsolete write_complex64() as write_complex_float32() is equivalent but simpler and faster.

+ subset/multilook: update usage of writefile.write_isce_xml()

+ view: update usage of readfile.get_slice_list()

Other minor changes:
+ subset.py: add --sub-x/y/lat/lon and --subset-x/y/lat/lon to be consistent with subset option names in other scripts.
+ view.py: add --nmli / --num-multilook for --multilook-num
+ simulation.simulation.py: typo fix and add missing wvl arg while calling timeseries2ifgram()
+ objects.sensor: typo fix for doppler_bandwidth
@yunjunz yunjunz merged commit 949437d into insarlab:main Aug 19, 2021
@yunjunz yunjunz deleted the io branch August 19, 2021 01:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant