-
-
Notifications
You must be signed in to change notification settings - Fork 103
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
[Bug]: PRM.py #153
Comments
I’m not sure why the original code does not work for you, but the result looks okay. There are pixel-wise coordinates and the real and imaginary parts of the complex values stored in the SLC. The output is a lazy Xarray dask dataset, so you can get the values like da.re.values. |
I use the da.re.values command, but it report the error, here is the error: |
Try da[‘re’].values |
It reported the same error |
To verify your installation, run any of the provided PyGMTSAR projects. If everything functions correctly without any code modifications, your installation and function usage are properly set up. If issues arise, there may be a problem with your Python installation or function usage. |
I have solved this bug, I changed the |
The coordinate (0.5, 0.5) represents the center of a pixel with boundaries defined by the corners (0,0), (0,1), (1,1), and (1,0). |
ok, get it, thank you |
That’s ok for a linear scale because some pixels have much higher amplitudes. By the way, nodata pixels are not exactly zero. |
How do you think what is the difference between ascending and descending orbits?:) |
When ascending, the radar image is inverted vertically, and when descending, the radar image is inverted horizontally. So when descending, do we need to change the order of distance? I am confused |
Of course, not. See the interactive PyGMTSAR notebooks for radar coordinates map examples. And you cannot change the radar coordinates because these are corresponding to the flight geometry. |
ok,thanks for you, I will see the book
… On 29 Jul 2024, at 00:45, Alexey Pechnikov ***@***.***> wrote:
Of course, not. See the interactive PyGMTSAR notebooks for radar coordinates map examples. And you cannot change the radar coordinates because these are corresponding to the flight geometry.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.
|
Radar data is always processed on a uniform radar coordinate grid. While it is possible to find corresponding geographic coordinates for every radar pixel, these coordinates are uneven and cannot be processed directly. This means that only the processed results can be geocoded and exported. |
Baseline is satellite geometry characteristic so it is the same for all the pixels. Satellite look vector differ for every pixel and depending of the satellite position and topography. |
Describe the bug
hello professor,
when I use the read_SLC_int function of the PRM.py, it report the error, here is the error
File "c:\Users\kjzha\.conda\envs\pygmt\Lib\runpy.py", line 198, in _run_module_as_main return _run_code(code, main_globals, None, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\Users\kjzha\.conda\envs\pygmt\Lib\runpy.py", line 88, in _run_code exec(code, run_globals) File "c:\Users\kjzha\.vscode\extensions\ms-python.debugpy-2024.8.0-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher/../..\debugpy\__main__.py", line 39, in <module> cli.main() File "c:\Users\kjzha\.vscode\extensions\ms-python.debugpy-2024.8.0-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 430, in main run() File "c:\Users\kjzha\.vscode\extensions\ms-python.debugpy-2024.8.0-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 284, in run_file runpy.run_path(target, run_name="__main__") File "c:\Users\kjzha\.vscode\extensions\ms-python.debugpy-2024.8.0-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 321, in run_path return _run_module_code(code, init_globals, run_name, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\Users\kjzha\.vscode\extensions\ms-python.debugpy-2024.8.0-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 135, in _run_module_code _run_code(code, mod_globals, init_globals, File "c:\Users\kjzha\.vscode\extensions\ms-python.debugpy-2024.8.0-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 124, in _run_code exec(code, run_globals) File "F:\下载文件\pygmtsar-pygmtsar2\pygmtsar-pygmtsar2\pygmtsar\temp2.py", line 44, in <module> block = dask.array.from_delayed( ^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: from_delayed() missing 1 required positional argument: 'shape'
It seems that the return value of the read_SLC-block function does not meet the requirements of dask.array.for_delayed, so I change the code, just like
values = dask.delayed(read_SLC_block(slc_file, start, stop))(2 * (stop - start)) block = dask.array.from_delayed( values, shape=(2 * (stop - start),), dtype=np.int16, )
then the code workshere is my all code :
import dask.delayed
import pygmt
import numpy as np
import xarray as xr
import numpy as np
import dask, dask.array
import os
import warnings
def read_SLC_block(slc_filename, start, stop):
return np.memmap(
slc_filename,
dtype=np.int16,
mode="r",
offset=start * 4,
shape=(2 * (stop - start),),
)
grd = r"F:\2018009_2018021\corr.grd"
slc_file = r"F:\raw\S1_20180110_ALL_F2.SLC"
scale=2.5e-07
xdim = 25272
ydim = 12192
chunksize = 2048
blocksize = chunksize * xdim
blocks = int(np.ceil(ydim * xdim / blocksize))
res = []
ims = []
for i in range(blocks):
start = i * blocksize
stop = min((i + 1) * blocksize, ydim * xdim)
values = dask.delayed(read_SLC_block(slc_file, start, stop))(2 * (stop - start))
block = dask.array.from_delayed(
values,
shape=(2 * (stop - start),),
dtype=np.int16,
)
res.append(block[::2])
ims.append(block[1::2])
del block
re = dask.array.concatenate(res).reshape((-1, xdim))[:ydim, :]
im = dask.array.concatenate(ims).reshape((-1, xdim))[:ydim, :]
del res, ims
coords = {"y": np.arange(ydim) + 0.5, "x": np.arange(xdim) + 0.5}
re = xr.DataArray(re, coords=coords).rename("re")
im = xr.DataArray(im, coords=coords).rename("im")
da = scale * (xr.merge([re, im]).astype(np.float32))
but I found the result is strange here is my result:
<xarray.Dataset> Size: 2GB
Dimensions: (y: 12192, x: 25272)
Coordinates:
Data variables:
re (y, x) float32 1GB dask.array<chunksize=(2048, 25272), meta=np.ndarray>
im (y, x) float32 1GB dask.array<chunksize=(2048, 25272), meta=np.ndarray>
it seems that the reuslt is not the SLC`s value, it's more like an offset of row and column numbers. can you give me some suggestion? look forward to your reply
The text was updated successfully, but these errors were encountered: