insarlab / MintPy

Miami InSAR time-series software in Python
https://mintpy.readthedocs.io
Other
575 stars 252 forks source link

Error when perform correct_troposphere for hyp3 products #1057

Closed Sugeradi985 closed 1 year ago

Sugeradi985 commented 1 year ago

Problem description

Hi, wish you all the best.

I want to do the time series analysis on the iterferograms generated by Hyp3.

And I have pre-processed the tiffs accordingly.

When came to the "correct_troposphere" ,I encounter errors.

After checking the generated file "ERA5.h5," which was just 14.4 kilobytes, it became apparent that something was wrong.

I used info.py to view the information for "ERA5.h5", but it was full of zeros.

I used view.py to plot the "ERA5.h5", but it was empty.

I've tried using different sets of interferograms (also generated by Hyp3), and they all come out the same way.

Full script that generated the error

tropo_pyaps3.py

Full error message

(insar) gmtsar-user@gmtsarVB:~/Share/process/Coastalplan/path069_frame124$ smallbaselineApp.py --dostep correct_troposphere
MintPy version 1.5.1, date 2023-01-03
--RUN-at-2023-08-05 20:08:04.263931--
Current directory: /home/gmtsar-user/Share/process/Coastalplan/path069_frame124
Run routine processing with smallbaselineApp.py on steps: ['correct_troposphere']
Remaining steps: ['deramp', 'correct_topography', 'residual_RMS', 'reference_date', 'velocity', 'geocode', 'google_earth', 'hdfeos5']
--------------------------------------------------
Go to work directory: /home/gmtsar-user/Share/process/Coastalplan/path069_frame124
read default template file: /home/gmtsar-user/Share/process/Coastalplan/path069_frame124/smallbaselineApp.cfg

******************** step - correct_troposphere ********************
Input data seems to be geocoded. Lookup file not needed.
Atmospheric correction using Weather Re-analysis dataset (PyAPS, Jolivet et al., 2011)
Weather Re-analysis dataset: ERA5

tropo_pyaps3.py -f /home/gmtsar-user/Share/process/Coastalplan/path069_frame124/timeseries.h5 --model ERA5 -g /home/gmtsar-user/Share/process/Coastalplan/path069_frame124/inputs/geometryGeo.h5 -w /home/gmtsar-user/Share/process/WeatherData
weather model: ERA5 - dry (hydrostatic) and wet delay
weather directory: /home/gmtsar-user/Share/process/WeatherData
output tropospheric delay     time-series file: /home/gmtsar-user/Share/process/Coastalplan/path069_frame124/inputs/ERA5.h5
output corrected displacement time-series file: /home/gmtsar-user/Share/process/Coastalplan/path069_frame124/timeseries_ERA5.h5
read dates/time info from file: /home/gmtsar-user/Share/process/Coastalplan/path069_frame124/timeseries.h5
time of cloest available product: 10:00 UTC

--------------------------------------------------------------------------------
Download global atmospheric model files...
update mode: ON
output file: /home/gmtsar-user/Share/process/Coastalplan/path069_frame124/inputs/ERA5.h5
1) output file either do NOT exist or is NOT newer than all GRIB files.
run or skip: run
--------------------------------------------------
downloading weather model data using PyAPS ...
common file size: 1478520 bytes
number of grib files existed    : 142
number of grib files to download: 0
--------------------------------------------------

--------------------------------------------------------------------------------
Calculate tropospheric delay and write to HDF5 file...
update mode: ON
output file: /home/gmtsar-user/Share/process/Coastalplan/path069_frame124/inputs/ERA5.h5
1) output file either do NOT exist or is NOT newer than all GRIB files.
run or skip: run
open geometry file: geometryGeo.h5
reading incidenceAngle  data from file: /home/gmtsar-user/Share/process/Coastalplan/path069_frame124/inputs/geometryGeo.h5 ...
reading height          data from file: /home/gmtsar-user/Share/process/Coastalplan/path069_frame124/inputs/geometryGeo.h5 ...
--------------------------------------------------
create HDF5 file: /home/gmtsar-user/Share/process/Coastalplan/path069_frame124/inputs/ERA5.h5 with w mode
create dataset  : date       of |S8                       in size of (142,)               with compression = None
create dataset  : timeseries of <class 'numpy.float32'>   in size of (142, 2873, 3603)    with compression = None
close  HDF5 file: /home/gmtsar-user/Share/process/Coastalplan/path069_frame124/inputs/ERA5.h5
--------------------------------------------------
calculating absolute delay for each date using PyAPS (Jolivet et al., 2011; 2014) ...
number of grib files used: 142
Traceback (most recent call last):
  File "/home/gmtsar-user/tools/miniconda3/envs/insar/bin/smallbaselineApp.py", line 8, in <module>
    sys.exit(main())
  File "/home/gmtsar-user/tools/MintPy/src/mintpy/cli/smallbaselineApp.py", line 208, in main
    run_smallbaselineApp(inps)
  File "/home/gmtsar-user/tools/MintPy/src/mintpy/smallbaselineApp.py", line 1117, in run_smallbaselineApp
    app.run(steps=inps.runSteps)
  File "/home/gmtsar-user/tools/MintPy/src/mintpy/smallbaselineApp.py", line 898, in run
    self.run_tropospheric_delay_correction(sname)
  File "/home/gmtsar-user/tools/MintPy/src/mintpy/smallbaselineApp.py", line 648, in run_tropospheric_delay_correction
    mintpy.cli.tropo_pyaps3.main(iargs)
  File "/home/gmtsar-user/tools/MintPy/src/mintpy/cli/tropo_pyaps3.py", line 166, in main
    run_tropo_pyaps3(inps)
  File "/home/gmtsar-user/tools/MintPy/src/mintpy/tropo_pyaps3.py", line 675, in run_tropo_pyaps3
    calc_delay_timeseries(inps)
  File "/home/gmtsar-user/tools/MintPy/src/mintpy/tropo_pyaps3.py", line 610, in calc_delay_timeseries
    tropo_data = get_delay(
  File "/home/gmtsar-user/tools/MintPy/src/mintpy/tropo_pyaps3.py", line 475, in get_delay
    aps_obj = pa.PyAPS(
  File "/home/gmtsar-user/tools/miniconda3/envs/insar/lib/python3.8/site-packages/pyaps3/objects.py", line 166, in __init__
    hgt = np.linspace(self.dict['minAltP'], gph.max().round(), self.dict['nhgt'])
  File "/home/gmtsar-user/tools/miniconda3/envs/insar/lib/python3.8/site-packages/numpy/core/_methods.py", line 40, in _amax
    return umr_maximum(a, axis, None, out, keepdims, initial, where)
ValueError: zero-size array to reduction operation maximum which has no identity

System information

# vim: set filetype=cfg:
##------------------------ smallbaselineApp.cfg ------------------------##
########## computing resource configuration
mintpy.compute.maxMemory = 50 #[float > 0.0], auto for 4, max memory to allocate in GB
## parallel processing with dask
## currently apply to steps: invert_network, correct_topography
## cluster   = none to turn off the parallel computing
## numWorker = all  to use all of locally available cores (for cluster = local only)
## numWorker = 80%  to use 80% of locally available cores (for cluster = local only)
## config    = none to rollback to the default name (same as the cluster type; for cluster != local)
mintpy.compute.cluster   = local #[local / slurm / pbs / lsf / none], auto for none, cluster type
mintpy.compute.numWorker = 18 #[int > 1 / all / num%], auto for 4 (local) or 40 (slurm / pbs / lsf), num of workers
mintpy.compute.config    = auto #[none / slurm / pbs / lsf ], auto for none (same as cluster), config name

########## 1. load_data
##---------add attributes manually
## MintPy requires attributes listed at: https://mintpy.readthedocs.io/en/latest/api/attributes/
## Missing attributes can be added below manually (uncomment #), e.g.
# ORBIT_DIRECTION = ascending
# PLATFORM = CSK
# ...
## a. autoPath - automatic path pattern defined in mintpy.defaults.auto_path.AUTO_PATH_*
## b. load_data.py -H to check more details and example inputs.
## c. compression to save disk usage for ifgramStack.h5 file:
## no   - save   0% disk usage, fast [default]
## lzf  - save ~57% disk usage, relative slow
## gzip - save ~62% disk usage, very slow [not recommend]
mintpy.load.processor       = hyp3  #[isce, aria, hyp3, gmtsar, snap, gamma, roipac], auto for isce
mintpy.load.autoPath        = auto  #[yes / no], auto for no, use pre-defined auto path
mintpy.load.updateMode      = auto  #[yes / no], auto for yes, skip re-loading if HDF5 files are complete
mintpy.load.compression     = auto  #[gzip / lzf / no], auto for no.
##---------for ISCE only:
mintpy.load.metaFile        = auto  #[path of common metadata file for the stack], i.e.: ./reference/IW1.xml, ./referenceShelve/data.dat
mintpy.load.baselineDir     = auto  #[path of the baseline dir], i.e.: ./baselines
##---------interferogram stack:
mintpy.load.unwFile         = /media/gmtsar-user/99B8260A8639FCDE/CoastalPlan/path069_frame124_20160109-20221227/*/*_unw_phase_clipped.tif  #[path pattern of unwrapped interferogram files]
mintpy.load.corFile         = /media/gmtsar-user/99B8260A8639FCDE/CoastalPlan/path069_frame124_20160109-20221227/*/*_corr_clipped.tif  #[path pattern of spatial coherence       files]
mintpy.load.connCompFile    = auto  #[path pattern of connected components    files], optional but recommended
mintpy.load.intFile         = auto  #[path pattern of wrapped interferogram   files], optional
mintpy.load.magFile         = auto  #[path pattern of interferogram magnitude files], optional
##---------ionosphere stack (optional):
mintpy.load.ionUnwFile      = auto  #[path pattern of unwrapped interferogram files]
mintpy.load.ionCorFile      = auto  #[path pattern of spatial coherence       files]
mintpy.load.ionConnCompFile = auto  #[path pattern of connected components    files], optional but recommended
##---------offset stack (optional):
mintpy.load.azOffFile       = auto  #[path pattern of azimuth offset file]
mintpy.load.rgOffFile       = auto  #[path pattern of range   offset file]
mintpy.load.azOffStdFile    = auto  #[path pattern of azimuth offset variance file], optional but recommended
mintpy.load.rgOffStdFile    = auto  #[path pattern of range   offset variance file], optional but recommended
mintpy.load.offSnrFile      = auto  #[path pattern of offset signal-to-noise ratio file], optional
##---------geometry:
mintpy.load.demFile         = /media/gmtsar-user/99B8260A8639FCDE/CoastalPlan/path069_frame124_20160109-20221227/*/*_dem_clipped.tif  #[path of DEM file]
mintpy.load.lookupYFile     = auto  #[path of latitude /row   /y coordinate file], not required for geocoded data
mintpy.load.lookupXFile     = auto  #[path of longitude/column/x coordinate file], not required for geocoded data
mintpy.load.incAngleFile    = /media/gmtsar-user/99B8260A8639FCDE/CoastalPlan/path069_frame124_20160109-20221227/*/*_lv_theta_clipped.tif  #[path of incidence angle file], optional but recommended
mintpy.load.azAngleFile     = /media/gmtsar-user/99B8260A8639FCDE/CoastalPlan/path069_frame124_20160109-20221227/*/*_lv_phi_clipped.tif  #[path of azimuth   angle file], optional
mintpy.load.shadowMaskFile  = auto  #[path of shadow mask file], optional but recommended
mintpy.load.waterMaskFile   = /media/gmtsar-user/99B8260A8639FCDE/CoastalPlan/path069_frame124_20160109-20221227/*/*_water_mask_clipped.tif  #[path of water  mask file], optional but recommended
mintpy.load.bperpFile       = auto  #[path pattern of 2D perpendicular baseline file], optional
##---------subset (optional):
## if both yx and lalo are specified, use lalo option unless a) no lookup file AND b) dataset is in radar coord
mintpy.subset.yx            = auto    #[y0:y1,x0:x1 / no], auto for no
mintpy.subset.lalo          = auto    #[S:N,W:E / no], auto for no
##---------multilook (optional):
## multilook while loading data with the specified method, to reduce dataset size
## method - nearest, mean and median methods are applicable to interferogram/ionosphere/offset stack(s), except for:
##   connected components and all geometry datasets, for which nearest is hardwired.
## Use mean / median method with caution! It could smoothen the noise for a better SNR, but it could also smoothen the
##   unwrapping errors, breaking the integer 2pi relationship, which is used in the unwrapping error correction.
##   If you really want to increase the SNR, consider re-generate your stack of interferograms with more looks instead.
mintpy.multilook.method     = auto    #[nearest, mean, median], auto for nearest - lines/rows skipping approach
mintpy.multilook.ystep      = auto    #[int >= 1], auto for 1 - no multilooking
mintpy.multilook.xstep      = auto    #[int >= 1], auto for 1 - no multilooking

########## 2. modify_network
## 1) Network modification based on temporal/perpendicular baselines, date, num of connections etc.
mintpy.network.tempBaseMax     = auto  #[1-inf, no], auto for no, max temporal baseline in days
mintpy.network.perpBaseMax     = auto  #[1-inf, no], auto for no, max perpendicular spatial baseline in meter
mintpy.network.connNumMax      = auto  #[1-inf, no], auto for no, max number of neighbors for each acquisition
mintpy.network.startDate       = auto  #[20090101 / no], auto for no
mintpy.network.endDate         = auto  #[20110101 / no], auto for no
mintpy.network.excludeDate     = auto  #[20080520,20090817 / no], auto for no
mintpy.network.excludeIfgIndex = auto  #[1:5,25 / no], auto for no, list of ifg index (start from 0)
mintpy.network.referenceFile   = auto  #[date12_list.txt / ifgramStack.h5 / no], auto for no

## 2) Data-driven network modification
## a - Coherence-based network modification = (threshold + MST) by default
## reference: Yunjun et al. (2019, section 4.2 and 5.3.1); Chaussard et al. (2015, GRL)
## It calculates a average coherence for each interferogram using spatial coherence based on input mask (with AOI)
## Then it finds a minimum spanning tree (MST) network with inverse of average coherence as weight (keepMinSpanTree)
## Next it excludes interferograms if a) the average coherence < minCoherence AND b) not in the MST network.
mintpy.network.coherenceBased  = auto  #[yes / no], auto for no, exclude interferograms with coherence < minCoherence
mintpy.network.minCoherence    = auto  #[0.0-1.0], auto for 0.7

## b - Effective Coherence Ratio network modification = (threshold + MST) by default
## reference: Kang et al. (2021, RSE)
## It calculates the area ratio of each interferogram that is above a spatial coherence threshold.
## This threshold is defined as the spatial coherence of the interferograms within the input mask.
## It then finds a minimum spanning tree (MST) network with inverse of the area ratio as weight (keepMinSpanTree)
## Next it excludes interferograms if a) the area ratio < minAreaRatio AND b) not in the MST network.
mintpy.network.areaRatioBased  = auto  #[yes / no], auto for no, exclude interferograms with area ratio < minAreaRatio
mintpy.network.minAreaRatio    = auto  #[0.0-1.0], auto for 0.75

## Additional common parameters for the 2) data-driven network modification
mintpy.network.keepMinSpanTree = auto  #[yes / no], auto for yes, keep interferograms in Min Span Tree network
mintpy.network.maskFile        = auto  #[file name, no], auto for waterMask.h5 or no [if no waterMask.h5 found]
mintpy.network.aoiYX           = auto  #[y0:y1,x0:x1 / no], auto for no, area of interest for coherence calculation
mintpy.network.aoiLALO         = auto  #[S:N,W:E / no], auto for no - use the whole area

########## 3. reference_point
## Reference all interferograms to one common point in space
## auto - randomly select a pixel with coherence > minCoherence
## however, manually specify using prior knowledge of the study area is highly recommended
##   with the following guideline (section 4.3 in Yunjun et al., 2019):
## 1) located in a coherence area, to minimize the decorrelation effect.
## 2) not affected by strong atmospheric turbulence, i.e. ionospheric streaks
## 3) close to and with similar elevation as the AOI, to minimize the impact of spatially correlated atmospheric delay
mintpy.reference.yx            = auto   #[257,151 / auto]
mintpy.reference.lalo          = auto   #[31.8,130.8 / auto]
mintpy.reference.maskFile      = auto   #[filename / no], auto for maskConnComp.h5
mintpy.reference.coherenceFile = auto   #[filename], auto for avgSpatialCoh.h5
mintpy.reference.minCoherence  = auto   #[0.0-1.0], auto for 0.85, minimum coherence for auto method

########## quick_overview
## A quick assessment of:
## 1) possible groud deformation
##    using the velocity from the traditional interferogram stacking
##    reference: Zebker et al. (1997, JGR)
## 2) distribution of phase unwrapping error
##    from the number of interferogram triplets with non-zero integer ambiguity of closue phase
##    reference: T_int in Yunjun et al. (2019, CAGEO). Related to section 3.2, equation (8-9) and Fig. 3d-e.

########## 4. correct_unwrap_error (optional)
## connected components (mintpy.load.connCompFile) are required for this step.
## SNAPHU (Chem & Zebker,2001) is currently the only unwrapper that provides connected components as far as we know.
## reference: Yunjun et al. (2019, section 3)
## supported methods:
## a. phase_closure          - suitable for highly redundant network
## b. bridging               - suitable for regions separated by narrow decorrelated features, e.g. rivers, narrow water bodies
## c. bridging+phase_closure - recommended when there is a small percentage of errors left after bridging
mintpy.unwrapError.method          = auto  #[bridging / phase_closure / bridging+phase_closure / no], auto for no
mintpy.unwrapError.waterMaskFile   = auto  #[waterMask.h5 / no], auto for waterMask.h5 or no [if not found]
mintpy.unwrapError.connCompMinArea = auto  #[1-inf], auto for 2.5e3, discard regions smaller than the min size in pixels

## phase_closure options:
## numSample - a region-based strategy is implemented to speedup L1-norm regularized least squares inversion.
##     Instead of inverting every pixel for the integer ambiguity, a common connected component mask is generated,
##     for each common conn. comp., numSample pixels are radomly selected for inversion, and the median value of the results
##     are used for all pixels within this common conn. comp.
mintpy.unwrapError.numSample       = auto  #[int>1], auto for 100, number of samples to invert for common conn. comp.

## bridging options:
## ramp - a phase ramp could be estimated based on the largest reliable region, removed from the entire interferogram
##     before estimating the phase difference between reliable regions and added back after the correction.
## bridgePtsRadius - half size of the window used to calculate the median value of phase difference
mintpy.unwrapError.ramp            = auto  #[linear / quadratic], auto for no; recommend linear for L-band data
mintpy.unwrapError.bridgePtsRadius = auto  #[1-inf], auto for 50, half size of the window around end points

########## 5. invert_network
## Invert network of interferograms into time-series using weighted least sqaure (WLS) estimator.
## weighting options for least square inversion [fast option available but not best]:
## a. var - use inverse of covariance as weight (Tough et al., 1995; Guarnieri & Tebaldini, 2008) [recommended]
## b. fim - use Fisher Information Matrix as weight (Seymour & Cumming, 1994; Samiei-Esfahany et al., 2016).
## c. coh - use coherence as weight (Perissin & Wang, 2012)
## d. no  - uniform weight (Berardino et al., 2002) [fast]
## SBAS (Berardino et al., 2002) = minNormVelocity (yes) + weightFunc (no)
mintpy.networkInversion.weightFunc      = auto #[var / fim / coh / no], auto for var
mintpy.networkInversion.waterMaskFile   = auto #[filename / no], auto for waterMask.h5 or no [if not found]
mintpy.networkInversion.minNormVelocity = auto #[yes / no], auto for yes, min-norm deformation velocity / phase

## mask options for unwrapPhase of each interferogram before inversion (recommend if weightFunct=no):
## a. coherence              - mask out pixels with spatial coherence < maskThreshold
## b. connectComponent       - mask out pixels with False/0 value
## c. no                     - no masking [recommended].
## d. range/azimuthOffsetStd - mask out pixels with offset std. dev. > maskThreshold [for offset]
mintpy.networkInversion.maskDataset   = auto #[coherence / connectComponent / rangeOffsetStd / azimuthOffsetStd / no], auto for no
mintpy.networkInversion.maskThreshold = auto #[0-inf], auto for 0.4
mintpy.networkInversion.minRedundancy = auto #[1-inf], auto for 1.0, min num_ifgram for every SAR acquisition

## Temporal coherence is calculated and used to generate the mask as the reliability measure
## reference: Pepe & Lanari (2006, IEEE-TGRS)
mintpy.networkInversion.minTempCoh  = auto #[0.0-1.0], auto for 0.7, min temporal coherence for mask
mintpy.networkInversion.minNumPixel = auto #[int > 1], auto for 100, min number of pixels in mask above
mintpy.networkInversion.shadowMask  = auto #[yes / no], auto for yes [if shadowMask is in geometry file] or no.

########## correct_LOD
## Local Oscillator Drift (LOD) correction (for Envisat only)
## reference: Marinkovic and Larsen (2013, Proc. LPS)
## automatically applied to Envisat data (identified via PLATFORM attribute)
## and skipped for all the other satellites.

########## correct_SET
## Solid Earth tides (SET) correction [need to install insarlab/PySolid]
## reference: Milbert (2018); Yunjun et al. (2022, IEEE-TGRS)
mintpy.solidEarthTides = auto #[yes / no], auto for no

########## 6. correct_troposphere (optional but recommended)
## correct tropospheric delay using the following methods:
## a. height_correlation - correct stratified tropospheric delay (Doin et al., 2009, J Applied Geop)
## b. pyaps - use Global Atmospheric Models (GAMs) data (Jolivet et al., 2011; 2014)
##      ERA5  - ERA5    from ECMWF [need to install PyAPS from GitHub; recommended and turn ON by default]
##      MERRA - MERRA-2 from NASA  [need to install PyAPS from Caltech/EarthDef]
##      NARR  - NARR    from NOAA  [need to install PyAPS from Caltech/EarthDef; recommended for N America]
## c. gacos - use GACOS with the iterative tropospheric decomposition model (Yu et al., 2018, JGR)
##      need to manually download GACOS products at http://www.gacos.net for all acquisitions before running this step
mintpy.troposphericDelay.method = auto  #[pyaps / height_correlation / gacos / no], auto for pyaps

## Notes for pyaps:
## a. GAM data latency: with the most recent SAR data, there will be GAM data missing, the correction
##    will be applied to dates with GAM data available and skipped for the others.
## b. WEATHER_DIR: if you define an environment variable named WEATHER_DIR to contain the path to a
##    directory, then MintPy applications will download the GAM files into the indicated directory.
##    MintPy application will look for the GAM files in the directory before downloading a new one to
##    prevent downloading multiple copies if you work with different dataset that cover the same date/time.
mintpy.troposphericDelay.weatherModel = auto  #[ERA5 / MERRA / NARR], auto for ERA5
mintpy.troposphericDelay.weatherDir   = auto  #[path2directory], auto for WEATHER_DIR or "./"

## Notes for height_correlation:
## Extra multilooking is applied to estimate the empirical phase/elevation ratio ONLY.
## For an dataset with 5 by 15 looks, looks=8 will generate phase with (5*8) by (15*8) looks
## to estimate the empirical parameter; then apply the correction to original phase (with 5 by 15 looks),
## if the phase/elevation correlation is larger than minCorrelation.
mintpy.troposphericDelay.polyOrder      = auto  #[1 / 2 / 3], auto for 1
mintpy.troposphericDelay.looks          = auto  #[1-inf], auto for 8, extra multilooking num
mintpy.troposphericDelay.minCorrelation = auto  #[0.0-1.0], auto for 0

## Notes for gacos:
## Set the path below to directory that contains the downloaded *.ztd* files
mintpy.troposphericDelay.gacosDir = auto # [path2directory], auto for "./GACOS"

########## 7. deramp (optional)
## Estimate and remove a phase ramp for each acquisition based on the reliable pixels.
## Recommended for localized deformation signals, i.e. volcanic deformation, landslide and land subsidence, etc.
## NOT recommended for long spatial wavelength deformation signals, i.e. co-, post- and inter-seimic deformation.
mintpy.deramp          = quadratic  #[no / linear / quadratic], auto for no - no ramp will be removed
mintpy.deramp.maskFile = auto  #[filename / no], auto for maskTempCoh.h5, mask file for ramp estimation

########## 8. correct_topography (optional but recommended)
## Topographic residual (DEM error) correction
## reference: Fattahi and Amelung (2013, IEEE-TGRS)
## stepFuncDate      - specify stepFuncDate option if you know there are sudden displacement jump in your area,
##                     e.g. volcanic eruption, or earthquake
## excludeDate       - dates excluded for the error estimation
## pixelwiseGeometry - use pixel-wise geometry (incidence angle & slant range distance)
##                     yes - use pixel-wise geometry if they are available [slow; used by default]
##                     no  - use the mean   geometry [fast]
mintpy.topographicResidual                   = auto  #[yes / no], auto for yes
mintpy.topographicResidual.polyOrder         = auto  #[1-inf], auto for 2, poly order of temporal deformation model
mintpy.topographicResidual.phaseVelocity     = auto  #[yes / no], auto for no - use phase velocity for minimization
mintpy.topographicResidual.stepFuncDate      = auto  #[20080529,20190704T1733 / no], auto for no, date of step jump
mintpy.topographicResidual.excludeDate       = auto  #[20070321 / txtFile / no], auto for exclude_date.txt
mintpy.topographicResidual.pixelwiseGeometry = auto  #[yes / no], auto for yes, use pixel-wise geometry info

########## 9.1 residual_RMS (root mean squares for noise evaluation)
## Calculate the Root Mean Square (RMS) of residual phase time-series for each acquisition
## reference: Yunjun et al. (2019, section 4.9 and 5.4)
## To get rid of long spatial wavelength component, a ramp is removed for each acquisition
## Set optimal reference date to date with min RMS
## Set exclude dates (outliers) to dates with RMS > cutoff * median RMS (Median Absolute Deviation)
mintpy.residualRMS.maskFile = auto  #[file name / no], auto for maskTempCoh.h5, mask for ramp estimation
mintpy.residualRMS.deramp   = auto  #[quadratic / linear / no], auto for quadratic
mintpy.residualRMS.cutoff   = auto  #[0.0-inf], auto for 3

########## 9.2 reference_date
## Reference all time-series to one date in time
## reference: Yunjun et al. (2019, section 4.9)
## no     - do not change the default reference date (1st date)
mintpy.reference.date = auto   #[reference_date.txt / 20090214 / no], auto for reference_date.txt

########## 10. velocity
## Estimate a suite of time functions [linear velocity by default]
## from final displacement file (and from tropospheric delay file if exists)
mintpy.timeFunc.startDate   = auto   #[20070101 / no], auto for no
mintpy.timeFunc.endDate     = auto   #[20101230 / no], auto for no
mintpy.timeFunc.excludeDate = auto   #[exclude_date.txt / 20080520,20090817 / no], auto for exclude_date.txt

## Fit a suite of time functions
## reference: Hetland et al. (2012, JGR) equation (2-9)
## polynomial function    is  defined by its degree in integer. 1 for linear, 2 for quadratic, etc.
## periodic   function(s) are defined by a list of periods in decimal years. 1 for annual, 0.5 for semi-annual, etc.
## step       function(s) are defined by a list of onset times in str in YYYYMMDD(THHMM) format
## exp & log  function(s) are defined by an onset time followed by an charateristic time in integer days.
##   Multiple exp and log functions can be overlaied on top of each other, achieved via e.g.:
##   20110311,60,120          - two functions sharing the same onset time OR
##   20110311,60;20170908,120 - separated by ";"
mintpy.timeFunc.polynomial = auto   #[int >= 0], auto for 1, degree of the polynomial function
mintpy.timeFunc.periodic   = auto   #[1,0.5 / list_of_float / no], auto for no, periods in decimal years
mintpy.timeFunc.stepDate   = auto   #[20110311,20170908 / 20120928T1733 / no], auto for no, step function(s)
mintpy.timeFunc.exp        = auto   #[20110311,60 / 20110311,60,120 / 20110311,60;20170908,120 / no], auto for no
mintpy.timeFunc.log        = auto   #[20110311,60 / 20110311,60,120 / 20110311,60;20170908,120 / no], auto for no

## Uncertainty quantification methods:
## a. residue    - propagate from fitting residue assuming normal dist. in time (Fattahi & Amelung, 2015, JGR)
## b. covariance - propagate from time series (co)variance matrix
## c. bootstrap  - bootstrapping (independently resampling with replacement; Efron & Tibshirani, 1986, Stat. Sci.)
mintpy.timeFunc.uncertaintyQuantification = auto   #[residue, covariance, bootstrap], auto for residue
mintpy.timeFunc.timeSeriesCovFile         = auto   #[filename / no], auto for no, time series covariance file
mintpy.timeFunc.bootstrapCount            = auto   #[int>1], auto for 400, number of iterations for bootstrapping

########## 11.1 geocode (post-processing)
# for input dataset in radar coordinates only
# commonly used resolution in meters and in degrees (on equator)
# 100,         90,          60,          50,          30,          20,          10
# 0.000925926, 0.000833334, 0.000555556, 0.000462963, 0.000277778, 0.000185185, 0.000092593
mintpy.geocode              = auto  #[yes / no], auto for yes
mintpy.geocode.SNWE         = auto  #[-1.2,0.5,-92,-91 / none ], auto for none, output extent in degree
mintpy.geocode.laloStep     = auto  #[-0.000555556,0.000555556 / None], auto for None, output resolution in degree
mintpy.geocode.interpMethod = auto  #[nearest], auto for nearest, interpolation method
mintpy.geocode.fillValue    = auto  #[np.nan, 0, ...], auto for np.nan, fill value for outliers.

########## 11.2 google_earth (post-processing)
mintpy.save.kmz             = auto   #[yes / no], auto for yes, save geocoded velocity to Google Earth KMZ file

########## 11.3 hdfeos5 (post-processing)
mintpy.save.hdfEos5         = auto   #[yes / no], auto for no, save time-series to HDF-EOS5 format
mintpy.save.hdfEos5.update  = auto   #[yes / no], auto for no, put XXXXXXXX as endDate in output filename
mintpy.save.hdfEos5.subset  = auto   #[yes / no], auto for no, put subset range info   in output filename

########## 11.4 plot
# for high-resolution plotting, increase mintpy.plot.maxMemory
# for fast plotting with more parallelization, decrease mintpy.plot.maxMemory
mintpy.plot           = auto  #[yes / no], auto for yes, plot files generated by default processing to pic folder
mintpy.plot.dpi       = auto  #[int], auto for 150, number of dots per inch (DPI)
mintpy.plot.maxMemory = auto  #[float], auto for 4, max memory used by one call of view.py for plotting.

Any help is greatly appreciated.

yunjunz commented 1 year ago

I would suggest check the following:

  1. you should set mintpy.troposphericDelay.method = gacos to turn on gacos tropospheric correction in mintpy.
  2. the gacos result is saved in GACOS.h5, not ERA5.h5 file.
Sugeradi985 commented 1 year ago

I would suggest check the following:

  1. you should set mintpy.troposphericDelay.method = gacos to turn on gacos tropospheric correction in mintpy.
  2. the gacos result is saved in GACOS.h5, not ERA5.h5 file.

Hi, your response is greatly appreciated. So, you mean that the removal of atmospheric delay can only be done now using gacos. Am I correct? Considering how well I have used era-5 in the past.

Anyway, I'll give it a try using GACOS.

Thanks again.

yunjunz commented 1 year ago

So, you mean that the removal of atmospheric delay can only be done now using gacos. Am I correct?

No, all methods should work as described. I was having the impression that you were trying to use gacos for tropospheric correction.

While testing PyAPS/ERA5 on the Ridgecrest EQ example dataset, I had an error as well, which is now fixed by #1061. But the error I had is different from yours, could you test that PR to check if it fixes your issue as well?

Sugeradi985 commented 1 year ago

So, you mean that the removal of atmospheric delay can only be done now using gacos. Am I correct?

No, all methods should work as described. I was having the impression that you were trying to use gacos for tropospheric correction.

While testing PyAPS/ERA5 on the Ridgecrest EQ example dataset, I had an error as well, which is now fixed by #1061. But the error I had is different from yours, could you test that PR to check if it fixes your issue as well?

Hi, thanks for your prompt response. OK, I will try the Ridgecrest dataset then.

Sugeradi985 commented 1 year ago

So, you mean that the removal of atmospheric delay can only be done now using gacos. Am I correct?

No, all methods should work as described. I was having the impression that you were trying to use gacos for tropospheric correction. While testing PyAPS/ERA5 on the Ridgecrest EQ example dataset, I had an error as well, which is now fixed by #1061. But the error I had is different from yours, could you test that PR to check if it fixes your issue as well?

Hi, thanks for your prompt response. OK, I will try the Ridgecrest dataset then.

I attempted to correct the troposphere on the Ridgecrest dataset. I downloaded the grb files online and attempted to generate the ERA5.h5 file. But the same error message was received.

******************** step - correct_troposphere ********************
Input data seems to be geocoded. Lookup file not needed.
Atmospheric correction using Weather Re-analysis dataset (PyAPS, Jolivet et al., 2011)
Weather Re-analysis dataset: ERA5

tropo_pyaps3.py -f /home/gmtsar-user/Documents/RidgecrestSenDT71/mintpy/timeseries.h5 --model ERA5 -g /home/gmtsar-user/Documents/RidgecrestSenDT71/mintpy/inputs/geometryGeo.h5 -w /home/gmtsar-user/Share/process/WeatherData
weather model: ERA5 - dry (hydrostatic) and wet delay
weather directory: /home/gmtsar-user/Share/process/WeatherData
output tropospheric delay     time-series file: /home/gmtsar-user/Documents/RidgecrestSenDT71/mintpy/inputs/ERA5.h5
output corrected displacement time-series file: /home/gmtsar-user/Documents/RidgecrestSenDT71/mintpy/timeseries_ERA5.h5
read dates/time info from file: /home/gmtsar-user/Documents/RidgecrestSenDT71/mintpy/timeseries.h5
time of cloest available product: 14:00 UTC

--------------------------------------------------------------------------------
Download global atmospheric model files...
update mode: ON
output file: /home/gmtsar-user/Documents/RidgecrestSenDT71/mintpy/inputs/ERA5.h5
1) output file either do NOT exist or is NOT newer than all GRIB files.
run or skip: run
--------------------------------------------------
downloading weather model data using PyAPS ...
common file size: 759240 bytes
number of grib files existed    : 7
number of grib files to download: 0
--------------------------------------------------

--------------------------------------------------------------------------------
Calculate tropospheric delay and write to HDF5 file...
update mode: ON
output file: /home/gmtsar-user/Documents/RidgecrestSenDT71/mintpy/inputs/ERA5.h5
1) output file either do NOT exist or is NOT newer than all GRIB files.
run or skip: run
open geometry file: geometryGeo.h5
reading incidenceAngle  data from file: /home/gmtsar-user/Documents/RidgecrestSenDT71/mintpy/inputs/geometryGeo.h5 ...
reading height          data from file: /home/gmtsar-user/Documents/RidgecrestSenDT71/mintpy/inputs/geometryGeo.h5 ...
--------------------------------------------------
create HDF5 file: /home/gmtsar-user/Documents/RidgecrestSenDT71/mintpy/inputs/ERA5.h5 with w mode
create dataset  : date       of |S8                       in size of (7,)                 with compression = None
create dataset  : timeseries of <class 'numpy.float32'>   in size of (7, 1125, 1500)      with compression = None
close  HDF5 file: /home/gmtsar-user/Documents/RidgecrestSenDT71/mintpy/inputs/ERA5.h5
--------------------------------------------------
calculating absolute delay for each date using PyAPS (Jolivet et al., 2011; 2014) ...
number of grib files used: 7
Traceback (most recent call last):
  File "/home/gmtsar-user/tools/miniconda3/envs/insar/bin/smallbaselineApp.py", line 8, in <module>
    sys.exit(main())
  File "/home/gmtsar-user/tools/MintPy/src/mintpy/cli/smallbaselineApp.py", line 208, in main
    run_smallbaselineApp(inps)
  File "/home/gmtsar-user/tools/MintPy/src/mintpy/smallbaselineApp.py", line 1117, in run_smallbaselineApp
    app.run(steps=inps.runSteps)
  File "/home/gmtsar-user/tools/MintPy/src/mintpy/smallbaselineApp.py", line 898, in run
    self.run_tropospheric_delay_correction(sname)
  File "/home/gmtsar-user/tools/MintPy/src/mintpy/smallbaselineApp.py", line 648, in run_tropospheric_delay_correction
    mintpy.cli.tropo_pyaps3.main(iargs)
  File "/home/gmtsar-user/tools/MintPy/src/mintpy/cli/tropo_pyaps3.py", line 166, in main
    run_tropo_pyaps3(inps)
  File "/home/gmtsar-user/tools/MintPy/src/mintpy/tropo_pyaps3.py", line 675, in run_tropo_pyaps3
    calc_delay_timeseries(inps)
  File "/home/gmtsar-user/tools/MintPy/src/mintpy/tropo_pyaps3.py", line 610, in calc_delay_timeseries
    tropo_data = get_delay(
  File "/home/gmtsar-user/tools/MintPy/src/mintpy/tropo_pyaps3.py", line 475, in get_delay
    aps_obj = pa.PyAPS(
  File "/home/gmtsar-user/tools/miniconda3/envs/insar/lib/python3.8/site-packages/pyaps3/objects.py", line 166, in __init__
    hgt = np.linspace(self.dict['minAltP'], gph.max().round(), self.dict['nhgt'])
  File "/home/gmtsar-user/tools/miniconda3/envs/insar/lib/python3.8/site-packages/numpy/core/_methods.py", line 40, in _amax
    return umr_maximum(a, axis, None, out, keepdims, initial, where)
ValueError: zero-size array to reduction operation maximum which has no identity

Due to the fact that ERA5.h5 is only 10+kb, I believe there is an issue.

Then, I tested the ERA5.h5 file provided with the Ridgecrest dataset and it worked well.

******************** step - correct_troposphere ********************
Input data seems to be geocoded. Lookup file not needed.
Atmospheric correction using Weather Re-analysis dataset (PyAPS, Jolivet et al., 2011)
Weather Re-analysis dataset: ERA5
--------------------------------------------
Use existed tropospheric delay file: ./inputs/ERA5.h5

diff.py /home/gmtsar-user/Documents/RidgecrestSenDT71/mintpy/timeseries.h5 ./inputs/ERA5.h5 -o /home/gmtsar-user/Documents/RidgecrestSenDT71/mintpy/timeseries_ERA5.h5 --force
/home/gmtsar-user/Documents/RidgecrestSenDT71/mintpy/timeseries.h5 - ['./inputs/ERA5.h5'] --> /home/gmtsar-user/Documents/RidgecrestSenDT71/mintpy/timeseries_ERA5.h5
the 1st input file is: timeseries
--------------------------------------------------
grab metadata from ref_file: /home/gmtsar-user/Documents/RidgecrestSenDT71/mintpy/timeseries.h5
grab dataset structure from ref_file: /home/gmtsar-user/Documents/RidgecrestSenDT71/mintpy/timeseries.h5
create HDF5 file: /home/gmtsar-user/Documents/RidgecrestSenDT71/mintpy/timeseries_ERA5.h5 with w mode
create dataset  : bperp      of float32                   in size of (7,)                 with compression = None
create dataset  : date       of |S8                       in size of (7,)                 with compression = None
create dataset  : timeseries of float32                   in size of (7, 1125, 1500)      with compression = None
close  HDF5 file: /home/gmtsar-user/Documents/RidgecrestSenDT71/mintpy/timeseries_ERA5.h5
read from file: ./inputs/ERA5.h5
* referencing data from ERA5.h5 to y/x: 1063/750
* referencing data from ERA5.h5 to date: 20190610
read from file: /home/gmtsar-user/Documents/RidgecrestSenDT71/mintpy/timeseries.h5
--------------------------------------------------
open  HDF5 file /home/gmtsar-user/Documents/RidgecrestSenDT71/mintpy/timeseries_ERA5.h5 in a mode
writing dataset /timeseries                block: [0, 7, 0, 1125, 0, 1500]
close HDF5 file /home/gmtsar-user/Documents/RidgecrestSenDT71/mintpy/timeseries_ERA5.h5.
time used: 00 mins 0.5 secs
yunjunz commented 1 year ago

Hmm... Could you check if your pyaps is installed and runs properly, by running the PyAPS/tests/test_calc.py script?

The output should look like below:

(insar) yunjunz:~>$ python tools/PyAPS/tests/test_calc.py 
------------------------------------------------
import pyaps3 from /Users/yunjunz/tools/PyAPS/src/pyaps3/__init__.py
------------------------------------------------
test tropospheric delay calculation from ERA5.
------------------------------------------------
read ISCE geometry files: hgt/los/lat/lon.rdr
calculate tropospheric delay from GRB files...
------------------------------------------------
INFO: INCIDENCE ANGLE AS AN ARRAY
INFO: AREA COVERAGE IN SNWE: (33.85, 30.05, 129.05, 132.45)
PROGRESS: READING GRIB FILE
INFO: USING PRESSURE LEVELS OF ERA-INT OR ERA-5 DATA
INFO: IMAGE DIMENSIONS: 15 LATITUDES AND 13 LONGITUDES
PROGRESS: INTERPOLATING FROM PRESSURE TO HEIGHT LEVELS
PROGRESS: COMPUTING DELAY FUNCTIONS
INFO: INCIDENCE ANGLE AS AN ARRAY
INFO: AREA COVERAGE IN SNWE: (33.85, 30.05, 129.05, 132.45)
PROGRESS: READING GRIB FILE
INFO: USING PRESSURE LEVELS OF ERA-INT OR ERA-5 DATA
INFO: IMAGE DIMENSIONS: 15 LATITUDES AND 13 LONGITUDES
PROGRESS: INTERPOLATING FROM PRESSURE TO HEIGHT LEVELS
PROGRESS: COMPUTING DELAY FUNCTIONS
PROGRESS: FINE INTERPOLATION OF HEIGHT LEVELS
PROGRESS: CREATE THE BILINEAR INTERPOLATION FUNCTION
PROGRESS: MAPPING THE DELAY
[============================================================]      0s /      0s
PROGRESS: FINE INTERPOLATION OF HEIGHT LEVELS
PROGRESS: CREATE THE BILINEAR INTERPOLATION FUNCTION
PROGRESS: MAPPING THE DELAY
[============================================================]      0s /      0s
------------------------------------------------
Passed tropospheric delay calculation from ERA5.
------------------------------------------------
Screenshot 2023-08-08 at 09 34 00
Sugeradi985 commented 1 year ago

Hmm... Could you check if your pyaps is installed and runs properly, by running the PyAPS/tests/test_calc.py script?

The output should look like below:

(insar) yunjunz:~>$ python tools/PyAPS/tests/test_calc.py 
------------------------------------------------
import pyaps3 from /Users/yunjunz/tools/PyAPS/src/pyaps3/__init__.py
------------------------------------------------
test tropospheric delay calculation from ERA5.
------------------------------------------------
read ISCE geometry files: hgt/los/lat/lon.rdr
calculate tropospheric delay from GRB files...
------------------------------------------------
INFO: INCIDENCE ANGLE AS AN ARRAY
INFO: AREA COVERAGE IN SNWE: (33.85, 30.05, 129.05, 132.45)
PROGRESS: READING GRIB FILE
INFO: USING PRESSURE LEVELS OF ERA-INT OR ERA-5 DATA
INFO: IMAGE DIMENSIONS: 15 LATITUDES AND 13 LONGITUDES
PROGRESS: INTERPOLATING FROM PRESSURE TO HEIGHT LEVELS
PROGRESS: COMPUTING DELAY FUNCTIONS
INFO: INCIDENCE ANGLE AS AN ARRAY
INFO: AREA COVERAGE IN SNWE: (33.85, 30.05, 129.05, 132.45)
PROGRESS: READING GRIB FILE
INFO: USING PRESSURE LEVELS OF ERA-INT OR ERA-5 DATA
INFO: IMAGE DIMENSIONS: 15 LATITUDES AND 13 LONGITUDES
PROGRESS: INTERPOLATING FROM PRESSURE TO HEIGHT LEVELS
PROGRESS: COMPUTING DELAY FUNCTIONS
PROGRESS: FINE INTERPOLATION OF HEIGHT LEVELS
PROGRESS: CREATE THE BILINEAR INTERPOLATION FUNCTION
PROGRESS: MAPPING THE DELAY
[============================================================]      0s /      0s
PROGRESS: FINE INTERPOLATION OF HEIGHT LEVELS
PROGRESS: CREATE THE BILINEAR INTERPOLATION FUNCTION
PROGRESS: MAPPING THE DELAY
[============================================================]      0s /      0s
------------------------------------------------
Passed tropospheric delay calculation from ERA5.
------------------------------------------------
Screenshot 2023-08-08 at 09 34 00

After thoroughly examining the detailed error message, I believe it was not caused by mintpy or pyaps, but by an environmental configuration issue.

I believe that numpy or scipy, or something else, is the cause of the issue, although it's not clear.

So I re-configured the Conda environment and it now works well.

Sorry for my own reasons, I mistakenly thought it was a bug.

I believe we can close this comment this time.

Thank you very much!

yunjunz commented 1 year ago

No worries, I am glad to hear you locate the cause and fix the issue!

Sugeradi985 commented 1 year ago

No worries, I am glad to hear you locate the cause and fix the issue!

Hi, it seems that the error is still present.

Traceback (most recent call last):
  File "/home/gmtsar-user/tools/mambaforge/envs/insar/bin/smallbaselineApp.py", line 8, in <module>
    sys.exit(main())
  File "/home/gmtsar-user/tools/MintPy/src/mintpy/cli/smallbaselineApp.py", line 208, in main
    run_smallbaselineApp(inps)
  File "/home/gmtsar-user/tools/MintPy/src/mintpy/smallbaselineApp.py", line 1117, in run_smallbaselineApp
    app.run(steps=inps.runSteps)
  File "/home/gmtsar-user/tools/MintPy/src/mintpy/smallbaselineApp.py", line 898, in run
    self.run_tropospheric_delay_correction(sname)
  File "/home/gmtsar-user/tools/MintPy/src/mintpy/smallbaselineApp.py", line 648, in run_tropospheric_delay_correction
    mintpy.cli.tropo_pyaps3.main(iargs)
  File "/home/gmtsar-user/tools/MintPy/src/mintpy/cli/tropo_pyaps3.py", line 166, in main
    run_tropo_pyaps3(inps)
  File "/home/gmtsar-user/tools/MintPy/src/mintpy/tropo_pyaps3.py", line 675, in run_tropo_pyaps3
    calc_delay_timeseries(inps)
  File "/home/gmtsar-user/tools/MintPy/src/mintpy/tropo_pyaps3.py", line 610, in calc_delay_timeseries
    tropo_data = get_delay(
  File "/home/gmtsar-user/tools/MintPy/src/mintpy/tropo_pyaps3.py", line 475, in get_delay
    aps_obj = pa.PyAPS(
  File "/home/gmtsar-user/tools/PyAPS/src/pyaps3/objects.py", line 177, in __init__
    hgt = np.linspace(self.dict['minAltP'], gph.max().round(), self.dict['nhgt'])
  File "/home/gmtsar-user/tools/mambaforge/envs/insar/lib/python3.9/site-packages/numpy/core/_methods.py", line 41, in _amax
    return umr_maximum(a, axis, None, out, keepdims, initial, where)
ValueError: zero-size array to reduction operation maximum which has no identity

I'm trying to print the message from some scripts.

PyAPS/src/pyaps3/objects.py", line 177, in init hgt = np.linspace(self.dict['minAltP'], gph.max().round(), self.dict['nhgt'])

Referring to the error message "ValueError: zero-size array to reduction operation maximum which has no identity", I think it was caused by the 'gph.max().round' function.

Then I realized that the gph (array) was empty, and defined in era.py line 208:

lats, lons = grb.latlons()
    #if model == 'ERA5':
    #    lons[lons < 0.] += 360.
    g = cdic['g']

    #extract indices 
    mask = ((lats > minlat) & (lats < maxlat)) & ((lons > minlon) & (lons < maxlon))
    uu = [i for i in list(range(np.shape(mask)[0])) if any(mask[i,:])]
    vv = [j for j in list(range(np.shape(mask)[1])) if any(mask[:,j])]

    latlist = lats[uu,:][:,vv]
    lonlist = lons[uu,:][:,vv]
    nlat, nlon = latlist.shape

    ####Create arrays for 3D storage
    gph = np.zeros((nlvls, nlat, nlon))   #Potential height

After following the output message step by step, I discovered that the coverage of lats(array) is different with the true latitude of the dataset.

With the Ridgecrest dataset, the output message is as follows:

calculating absolute delay for each date using PyAPS (Jolivet et al., 2011; 2014) ...
number of grib files used: 7
lats[10]=
[37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5
 37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5
 37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5
 37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5
 37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5
 37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5 37.5]
lons[10]=
[-130.   -129.75 -129.5  -129.25 -129.   -128.75 -128.5  -128.25 -128.
 -127.75 -127.5  -127.25 -127.   -126.75 -126.5  -126.25 -126.   -125.75
 -125.5  -125.25 -125.   -124.75 -124.5  -124.25 -124.   -123.75 -123.5
 -123.25 -123.   -122.75 -122.5  -122.25 -122.   -121.75 -121.5  -121.25
 -121.   -120.75 -120.5  -120.25 -120.   -119.75 -119.5  -119.25 -119.
 -118.75 -118.5  -118.25 -118.   -117.75 -117.5  -117.25 -117.   -116.75
 -116.5  -116.25 -116.   -115.75 -115.5  -115.25 -115.   -114.75 -114.5
 -114.25 -114.   -113.75 -113.5  -113.25 -113.   -112.75 -112.5  -112.25
 -112.   -111.75 -111.5  -111.25 -111.   -110.75 -110.5  -110.25 -110.  ]
mask:
[[False False False ... False False False]
 [False False False ... False False False]
 [False False False ... False False False]
 ...
 [False False False ... False False False]
 [False False False ... False False False]
 [False False False ... False False False]]
minlat,minlon,maxlat,maxlon:
-1.199681364756279 ,  -122.68980303959215 ,  1.2003260023253484 ,  -120.28979109842726
nlvls:
37
nlat:
0
nlon:
0
uu and vv
[] ,  []

We can see that, the output minlat (-1.199681364756279), maxlat(1.2003260023253484 ) are incorrect. So the mask (array) is full of False.

These two arrays are calculated using the formula in PyAPS/src/pyaps3/objects.py, in lin 111:

        # Problems in isce when lon and lat arrays have weird numbers
        if self.grib in ('ERA5','ERAINT','HRES'):
            self.lon[self.lon > 180.] -= 360.
        else:
            self.lon[self.lon < 0.] += 360.0
        self.minlon = np.nanmin(self.lon[np.nonzero(self.mask)]) - self.bufspc
        self.maxlon = np.nanmax(self.lon[np.nonzero(self.mask)]) + self.bufspc
        self.minlat = np.nanmin(self.lat[np.nonzero(self.mask)]) - self.bufspc
        self.maxlat = np.nanmax(self.lat[np.nonzero(self.mask)]) + self.bufspc
        if verb:
            print('INFO: AREA COVERAGE IN SNWE: ({:.2f}, {:.2f}, {:.2f}, {:.2f})'.format(
                self.maxlat, self.minlat, self.minlon, self.maxlon))

So, I think there may be some errors in calculating the min- and max-latitude.

yunjunz commented 1 year ago

For errors in pyaps, please consider opening an issue on its repo instead. Nevertheless, I could successfully run Ridgecrest dataset with pyaps, so my guess is that your code is not properly installed. I would recommend re-installing them from scratch before digging into the code. Both PyAPS and MintPy have tests, use them to check your installation.

Sugeradi985 commented 1 year ago

Hmm, I reinstalled them yesterday following your guide on conda-envs. Both tests are effective.

May I ask you to test the Ridgecrest dataset without the ERA5.h5 file under mintpy/inputs ? Simply delete the mintpy/inputs/ERA5.h5 fisrt, then run pyaps.

Thanks!

yunjunz commented 1 year ago

While testing PyAPS/ERA5 on the Ridgecrest EQ example dataset, I had an error as well, which is now fixed by https://github.com/insarlab/MintPy/pull/1061.

I already did previously. If you could strictly follow the bug report template, and fill in all the details, it could help to replicate your issue.