Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyAPS ndarray is not C-contiguous error with scipy.interpolate #949

Closed
bbuzz31 opened this issue Jan 26, 2023 · 2 comments · Fixed by #968
Closed

PyAPS ndarray is not C-contiguous error with scipy.interpolate #949

bbuzz31 opened this issue Jan 26, 2023 · 2 comments · Fixed by #968
Labels

Comments

@bbuzz31
Copy link
Contributor

bbuzz31 commented Jan 26, 2023

I'm getting the following error when running MintPy with ERA5 pyAPS corrections:

Traceback (most recent call last):
  File "/Users/buzzanga/Miniconda3/envs/MintPy/bin/smallbaselineApp.py", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/buzzanga/Software_InSAR/MintPy_git/src/mintpy/cli/smallbaselineApp.py", line 208, in main
    run_smallbaselineApp(inps)
  File "/Users/buzzanga/Software_InSAR/MintPy_git/src/mintpy/smallbaselineApp.py", line 1117, in run_smallbaselineApp
    app.run(steps=inps.runSteps)
  File "/Users/buzzanga/Software_InSAR/MintPy_git/src/mintpy/smallbaselineApp.py", line 898, in run
    self.run_tropospheric_delay_correction(sname)
  File "/Users/buzzanga/Software_InSAR/MintPy_git/src/mintpy/smallbaselineApp.py", line 648, in run_tropospheric_delay_correction
    mintpy.cli.tropo_pyaps3.main(iargs)
  File "/Users/buzzanga/Software_InSAR/MintPy_git/src/mintpy/cli/tropo_pyaps3.py", line 166, in main
    run_tropo_pyaps3(inps)
  File "/Users/buzzanga/Software_InSAR/MintPy_git/src/mintpy/tropo_pyaps3.py", line 716, in run_tropo_pyaps3
    calc_delay_timeseries(inps)
  File "/Users/buzzanga/Software_InSAR/MintPy_git/src/mintpy/tropo_pyaps3.py", line 610, in calc_delay_timeseries
    tropo_data = get_delay(
                 ^^^^^^^^^^
  File "/Users/buzzanga/Software_InSAR/MintPy_git/src/mintpy/tropo_pyaps3.py", line 488, in get_delay
    aps_obj.getdelay(pha)
  File "/Users/buzzanga/Miniconda3/envs/MintPy/lib/python3.11/site-packages/pyaps3/objects.py", line 310, in getdelay
    val = linearint(np.vstack((lati, loni, D)).T)*np.pi*4.0/(cinc*wvl)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/buzzanga/Miniconda3/envs/MintPy/lib/python3.11/site-packages/scipy/interpolate/_rgi.py", line 331, in __call__
    indices, norm_distances = self._find_indices(xi.T)
                              ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/buzzanga/Miniconda3/envs/MintPy/lib/python3.11/site-packages/scipy/interpolate/_rgi.py", line 499, in _find_indices
    return find_indices(self.grid, xi)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "_rgi_cython.pyx", line 95, in scipy.interpolate._rgi_cython.find_indices
  File "stringsource", line 660, in View.MemoryView.memoryview_cwrapper
  File "stringsource", line 350, in View.MemoryView.memoryview.__cinit__
ValueError: ndarray is not C-contiguous

If i run MintPy again, with the same config file, the error is not raised, and timeseries_ERA5.h5 is written
However, each date slice in the inputs/ERA5.h5 file is all 0s, and the resulting timeseries_ERA5.h5 is - as expected - identical to timeseries.h5. This happens with the the latest conda release and the last comment on main.

Please use this PR for testing with ARIA tools

ariaDownload.py -t 71 --bbox '32.9798 34.9440 -119.2723 -116.2523' -s 20200112 -e 20200130 -w ./products
ariaTSsetup.py -f './products/S1*.nc' -l 'unwrappedPhase' --bbox '32.9798 34.9440 -119.2723 -116.2523' -d ./DEM/SRTM_3arcsec.dem -w ./TEST5 -nt 1

mkdir TEST5/MP
cd TEST5/MP
smallbaselineApp.py TEST.cfg

and here's the config file (TEST.cfg), make sure you put it in TEST5/MP

mintpy.load.processor      = aria
mintpy.load.updateMode     = no
mintpy.load.unwFile        = ../stack/unwrapStack.vrt
mintpy.load.corFile        = ../stack/cohStack.vrt  
mintpy.load.connCompFile   = ../stack/connCompStack.vrt 

mintpy.load.demFile        = ../DEM/SRTM_3arcsec.dem 
mintpy.load.incAngleFile   = ../incidenceAngle/*.vrt 
mintpy.load.azAngleFile    = ../azimuthAngle/*.vrt  

mintpy.networkInversion.weightFunc = no
mintpy.network.coherenceBased  = no

mintpy.solidEarthTides = no #[yes / no], auto for no
mintpy.troposphericDelay.method       = pyaps #[pyaps / gacos / no]
mintpy.troposphericDelay.weatherModel = ERA5 #[ERA5 / MERRA / NARR], auto for ERA5a
mintpy.troposphericDelay.weatherDir   = auto

mintpy.topographicResidual                   = no

mintpy.reference.date = no # first date


########## 10. velocity
mintpy.timeFunc.polynomial = 1   #[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.startDate   = auto   #[20070101 / no], auto for no
mintpy.timeFunc.endDate     = auto   #[20101230 / no], auto for no
mintpy.timeFunc.excludeDate = no     # auto for exclude_date.tx

mintpy.save.kmz             = no
mintpy.plot                 = no   


@yunjunz
Copy link
Member

yunjunz commented Jan 26, 2023

Hi @bbuzz31, this is a recent bug introduced in scipy 1.10 in its interpolate sub-module. Since pyaps and mintpy use this sub-module, the circle CI testings have failed too, with the same error you have. This bug has been fixed and merged in scipy/scipy#17717, we will have it automatically after the next patch release of scipy. So let's just wait.

In the meanwhile, put a scipy<1.10 version constraint while installing the dependencies of your conda environment.

Let's keep this issue open so that other users are aware of this as well.

@yunjunz yunjunz changed the title PyAPS ndarray is not C-contiguous error PyAPS ndarray is not C-contiguous error with scipy.interpolate Jan 26, 2023
@yunjunz yunjunz added the bug label Jan 26, 2023
@bbuzz31
Copy link
Contributor Author

bbuzz31 commented Jan 26, 2023

aha thanks @yunjunz ! Sorry I missed that in their issues.

Naturally, we just forced scipy >= 1.10 in AT and RAiDER so that we can give descending values to the scipy interpolator... but luckily I think this latter functionality exists in 1.9.0 also

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants