Skip to content

load ionosphere stack from isce2/topsStack#780

Merged
yunjunz merged 9 commits intoinsarlab:mainfrom
yuankailiu:dev.loadStack
Jun 12, 2022
Merged

load ionosphere stack from isce2/topsStack#780
yunjunz merged 9 commits intoinsarlab:mainfrom
yuankailiu:dev.loadStack

Conversation

@yuankailiu
Copy link
Contributor

@yuankailiu yuankailiu commented May 24, 2022

In these updates, the attempt is to load the ionosphere datasets from topsStack processor into MintPy as an independent ionoStack.h5. Thus, it can be inverted separately to a time series for ionosphere correction in the time-series domain.

  • load ionosphere files (phase, coherence) from topsStack
  • create an independent ionoStack.h5 for iono datasets
  • handle xstep/10, ystep/10 for ionoStack.h5 (topStack iono was further multilook)
  • add an option to allow load_data.py to load only the geometry files
  • when creating stack file, fill nan for missing pairs (remove it)
  • add identidyable datasetName 'ionoPhase', 'ionoCoherence' in several codes (just be consistent with ifgramStack)
  • trailing whitespaces removed in several places

New functionalities in load_data.py:
load_data.py --help

  --geom                Only write the geometry files
  --ionostack           Switch to load the ionospheric pairs into an independent stack
                        (define paths in the template file)

The general workflow with ionospheric correction could be:

cd ${mintpy_work_dir}/

# 1. Regular time series analysis w/o iono correction, until network inversion
smallbaselineApp.py ${config} --dostep invert_network

# 2.1 Load the iono stack separately
load_data.py -t ${config} --project AqabaSenAT087 --ionstack

# 2.2 Remember to reference the ionoStack
reference_point.py inputs/ionoStack.h5 -t ${config}

# 2.3 We can plot the iono network (change four file names)
plot_network.py inputs/ionStack.h5 -t ${config} --nodisplay --cmap-vlist 0.2 0.7 1.0

# 2.4 Invert the ionoStack separately with no weighting
ifgram_inversion.py inputs/ionStack.h5 -m waterMask.h5 -w no --update

# 3. Phase corrections: since the iono correction is not integrated into the smallbaselineApp.py yet,
# one needs to run the stand-alone scripts for each correction.
diff.py timeseries.h5 inputs/ion.h5 -o timeseries_ion.h5
tropo_pyaps3.py timeseries_ion.h5 -g inputs/geometryRadar.h5 -o timeseries_ion_ERA5.h5
...

You will need to have a template configuration file containing the following:

##---------interferogram datasets:
mintpy.load.unwFile        = ../submit_arrays/merged/interferograms/*_*/filt_fine.unw  #[path pattern of unwrapped interferogram files]
mintpy.load.corFile        = ../submit_arrays/merged/interferograms/*_*/filt_fine.cor  #[path pattern of spatial coherence       files]
mintpy.load.connCompFile   = ../submit_arrays/merged/interferograms/*_*/filt_fine.unw.conncomp  #[path pattern of connected components    files], optional but recommended
mintpy.load.intFile        = ../submit_arrays/merged/interferograms/*_*/filt_fine.int  #[path pattern of wrapped interferogram   files], optional
mintpy.load.ionUnwFile       = ../submit_arrays/ion/*_*/ion_cal/filt.ion                 #[path pattern of ionospheric delay       files], optional

We better set downsampling here, so it downsample the regular InSAR files 10 times:

##---------multilook (optional):
## multilook while loading data with nearest interpolation, to reduce dataset size
mintpy.load.ystep          = 10    #[int >= 1], auto for 1 - no multilooking
mintpy.load.xstep          = 10    #[int >= 1], auto for 1 - no multilooking

Since topStack generated iono files are already 10 times less in size, in my code it will divide this {xstep, ystep} by 10 (10/10=1, thus no further down sampling for the iono) to handle that factor. Thus, after loading, the ionoStack and regular InSAR stack (ifgramStack) will have the same dimension.
But if you have {xstep, ystep}<10 here, then the downsampling for iono will be less than 1. The code will just skip downsampling the iono files. Then your iono stack and regular InSAR stack will have different size. You will need to sample them by yourself later on when you want to difference them. So unless you already sample the topsStack products using gdal externally, just always set {xstep, ystep} = {10,10} to save hassle.

Reminders

  • Pass Codacy code review (green)
  • Pass Circle CI 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.

@yunjunz yunjunz self-requested a review May 25, 2022 00:15
@yunjunz yunjunz changed the title load_data development: topsStack load iono stack from isce2/topsStack May 25, 2022
@yuankailiu
Copy link
Contributor Author

@mohseniaref-InSAR
Please look at our PR here!

@mohseniaref-InSAR
Copy link

mohseniaref-InSAR commented May 25, 2022

Thanks so much @yuankailiu . I have another solution, I am currently at EGU, I will contact you how to implement it in Mintpy , thanks so much for your message

@yuankailiu
Copy link
Contributor Author

yuankailiu commented May 30, 2022

Thank you, @yunjunz for the modifications!
I will further modify the following things as we discuss offline last time:

  • When creating the stack file, fill nan for missing pairs: this is not needed since we will have a separate ionosphere stack file. So I will remove this part of the code.
  • Use consistent file names: ionStack.h5 and save it under inputs/
  • Ionosphere outputs from the ifgram_inversion.py will also be named as ion.h5 and saved under inputs/
  • All the ionosphere-related files will be named using *ion*.
  • Use common datasetName unwrapPhase and coherence for the ionosphere stack file ionStack.h5. Then we don't need to add more identifiable datasetNames in several codes.
  • In the template file, name the ionosphere data files as ionUnwFile, ionCorFile, ionConnCompFile (connComp file is optional)
  • About xstep and ystep for the ionosphere file: I will write out the scaling explicitly in the code as comment, such as
    factor   = (looks_ionIfgram)/(looks_ifgram) = 10 (for the case of topsStack)
    ionXStep = (xstep/factor)
    ionYStep = (ystep/factor)
    

@yuankailiu yuankailiu changed the title load iono stack from isce2/topsStack load ionosphere stack from isce2/topsStack Jun 8, 2022
+ load_data.py --ionstack ionosphere files (unwrapPhase, coherence, connectComponent) from topsStack products
+ load_data.py --ionstack will create an independent `ionStack.h5` for ionosphere datasets
+ load_data.py --ionstack will handle dimensions (xstep, ystep) (topStack ionosphere interferograms were further multilook)
+ load_data.py --geom: this is an added option to load only the geometry files
+ add identidyable filenames to iono-related files in several places
+ trailing whitespaces removed in several places

[updates]:
suggested PR comments from insarlab#780 (comment)
@yuankailiu
Copy link
Contributor Author

@yunjunz, I have modify the above suggestions from #780 (comment)

@yunjunz
Copy link
Member

yunjunz commented Jun 9, 2022

Thank you @yuankailiu, I will take a look again today.

yunjunz added 8 commits June 11, 2022 13:23
Set default TS ion file name without underscore, and move them out of "inputs", as we have ionStack inside "inputs" folder already.
+ smallbaselineApp.cfg: add descriptions for ionosphere stack

+ auto_path.py: support auto path for ionStack from isce2/topsStack

+ load_data:
   - split datasetName2templateKey into 4 dict objects, to help to distinguish between regular stack and ion stack, while setting the correct template key
   - set --ion / geom as mutually exclusive arg for more robust user typo checking
   - add example cmd in help msg
   - add Parameters/Returns comments for most functions
   - rename update_object() to run_or_skip() for consistency and a more intuitive name
   - remove the different y/xstep calculation for ionStack, for simplicity, on both the user side and the developer side. An extra PR to diff.py is needed to be able to handle the different resolution between two input files, to support the iono correction in TS.
+ load_data: roll back the read_subset_box() to the later location, after prepare_metadata().

+ load_data.run_or_skip(): add the checking of dataset list between in/out stack file/obj

+ stackDict.ifgramStackDict: add get_dataset_list()

+ plot_network: disable color coding when no dataset found in file.
Copy link
Member

@yunjunz yunjunz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for the PR @yuankailiu. All look good to me.

Re-thinking the x/ystep and its explanations in the comment, I think it's easier to keep the same values for ionStack without special treatment, for both users and developers. Thus, I have removed related parts of the code. Nevertheless, another PR to the diff.py is needed to handle the different resolutions between two inputs TS files, when applying for the iono correction.

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.

3 participants