Giter VIP home page Giter VIP logo

Comments (6)

StephanLo avatar StephanLo commented on July 18, 2024

(I don't mean this is a bug necessarily, it is probably just me not understanding how to open the file correctly, it seems the bug label was added automatically and I can't see how to remove it. Sorry!)

from pyrosar.

johntruckenbrodt avatar johntruckenbrodt commented on July 18, 2024

Dear @StephanLo,
thanks for reaching out. In principle Tandem-x CoSSC should be supported.
The driver is TDX. This is a community contribution and I have never tried the driver iteself.

For reading a product you need to provide the top folder of the product instead of the XML file.
Could you try importing this class directly and try to identify the top folder of your product?

from pyroSAR.drivers import TDX
scene = TDX('top product folder')

If this does not work, what is the error message?

from pyrosar.

StephanLo avatar StephanLo commented on July 18, 2024

Dear @johntruckenbrodt
Thanks for your response

It worked thank you! Expect that I think it is maybe TDM instead of TDX, as in documentation

from pyroSAR.drivers import TDM
scene = TDM(Path(data_dir, name).as_posix())
print(scene)

Loads the product properly:

pyroSAR ID object of type TDM
acquisition_mode: SM
cycleNumber: 430
frameNumber: 2673131
lines: 28234
orbit: A
orbitNumber_abs: 71776
orbitNumber_rel: 133
polarizations: ['HH']
product: COSSC
projection: +proj=longlat +datum=WGS84 +no_defs
samples: 17438
sensor: TDM1
spacing: (0.00028334792733302643, 9.10033168464242e-09)
start: 20200524T212643
stop: 20200524T212651

However, I'm still struggling, because identify doesn't seem to work, despite the same parent product directory being supplied.

from pathlib import Path
from pyroSAR import identify
data_dir = Path("E:/stephan/files/Landfill/dem_timeseries/vanZyl_sites")

name = "TDM1_SAR__COS_BIST_SM_S_SRA_20200524T212643_20200524T212651"
identify(Path(data_dir, name).as_posix())

gives error

File [c:\Users\stephan\mambaforge\envs\for_snap\Lib\site-packages\pyroSAR\drivers.py:125](file:///C:/Users/stephan/mambaforge/envs/for_snap/Lib/site-packages/pyroSAR/drivers.py:125), in identify(scene)
    [123](file:///c%3A/Users/stephan/mambaforge/envs/for_snap/Lib/site-packages/pyroSAR/drivers.py?line=122)     except (RuntimeError, KeyError, AttributeError):
    [124](file:///c%3A/Users/stephan/mambaforge/envs/for_snap/Lib/site-packages/pyroSAR/drivers.py?line=123)         pass
--> [125](file:///c%3A/Users/stephan/mambaforge/envs/for_snap/Lib/site-packages/pyroSAR/drivers.py?line=124) raise RuntimeError('data format not supported')

RuntimeError: data format not supported

And, it seems the gpt command from pyroSAR.snap.auxil calls the identify function internally, so gpt then fails for the TDM CoSSC data, because identify returns the same 'data not supported' error

my_graph = "[...]/graphs/pyro_tandemx_to_snaphu.xml"

from pyroSAR.snap.auxil import gpt
gpt(my_graph, tmpdir= Path(data_dir, 'tmp'))

Error message:

from pyroSAR.snap.auxil import gpt
----> [158](file:///c%3A/Users/stephan/hokudai/PhD/Landfill/Code/SAR_idea/python/snap/tandem_X.qmd?line=157) gpt(my_graph, tmpdir= Path(data_dir, 'tmp'))

File [c:\Users\stephan\mambaforge\envs\for_snap\Lib\site-packages\pyroSAR\snap\auxil.py:363](file:///C:/Users/stephan/mambaforge/envs/for_snap/Lib/site-packages/pyroSAR/snap/auxil.py:363), in gpt(xmlfile, tmpdir, groups, cleanup, gpt_exceptions, gpt_args, removeS1BorderNoiseMethod)
    [361](file:///c%3A/Users/stephan/mambaforge/envs/for_snap/Lib/site-packages/pyroSAR/snap/auxil.py?line=360) else:
    [362](file:///c%3A/Users/stephan/mambaforge/envs/for_snap/Lib/site-packages/pyroSAR/snap/auxil.py?line=361)     read = workflow['Read']
--> [363](file:///c%3A/Users/stephan/mambaforge/envs/for_snap/Lib/site-packages/pyroSAR/snap/auxil.py?line=362)     scene = identify(read.parameters['file'])
    [365](file:///c%3A/Users/stephan/mambaforge/envs/for_snap/Lib/site-packages/pyroSAR/snap/auxil.py?line=364) tmpdir_bnr = os.path.join(tmpdir, 'bnr')
    [366](file:///c%3A/Users/stephan/mambaforge/envs/for_snap/Lib/site-packages/pyroSAR/snap/auxil.py?line=365) tmpdir_sub = os.path.join(tmpdir, 'sub')

File [c:\Users\stephan\mambaforge\envs\for_snap\Lib\site-packages\pyroSAR\drivers.py:125](file:///C:/Users/stephan/mambaforge/envs/for_snap/Lib/site-packages/pyroSAR/drivers.py:125), in identify(scene)
    [123](file:///c%3A/Users/stephan/mambaforge/envs/for_snap/Lib/site-packages/pyroSAR/drivers.py?line=122)     except (RuntimeError, KeyError, AttributeError):
    [124](file:///c%3A/Users/stephan/mambaforge/envs/for_snap/Lib/site-packages/pyroSAR/drivers.py?line=123)         pass
--> [125](file:///c%3A/Users/stephan/mambaforge/envs/for_snap/Lib/site-packages/pyroSAR/drivers.py?line=124) raise RuntimeError('data format not supported')

RuntimeError: data format not supported

Do you have any advice on this?
Thank you for the assistance!
kindly
Stephan

from pyrosar.

StephanLo avatar StephanLo commented on July 18, 2024

Just another comment that I think might be of interest,

I think the problem is maybe specific to the TDM driver for CoSSC data.
Because, identify works for TSX products

Basically, In the CoSSC product folder there are two sub-directories (for each of the two co-registered scenes)
And, if I supply one of the sub-directories to identify, it succeeds, and sees the loaded product as a TSX product.
(the same sub-directory can also be read directly with the TSX driver)

from pathlib import Path
from pyroSAR import identify
data_dir = Path("E:/stephan/files/Landfill/dem_timeseries/vanZyl_sites")

# rio 2020
name = "TDM1_SAR__COS_BIST_SM_S_SRA_20200524T212643_20200524T212651"
# The sub directory for one of the coregistered scenes
sub_name = "TDX1_SAR__SSC_BTX1_SM_S_SRA_20200524T212643_20200524T212651"

scene = identify(Path(data_dir, name, sub_name).as_posix())

print(scene)

Output:

pyroSAR ID object of type TSX
acquisition_mode: SM
cycleNumber: 430
frameNumber: 2673131
lines: 28234
orbit: A
orbitNumber_abs: 71776
orbitNumber_rel: 133
polarizations: ['HH']
product: SSC
projection: +proj=longlat +datum=WGS84 +no_defs
samples: 17438
sensor: TDX1
spacing: (0.00028334792733302643, 9.10033168464242e-09)
start: 20200524T212643
stop: 20200524T212651

from pyrosar.

johntruckenbrodt avatar johntruckenbrodt commented on July 18, 2024

Dear @StephanLo. I have found the error and will merge the fix in a minute. Thanks again.

from pyrosar.

StephanLo avatar StephanLo commented on July 18, 2024

Thank you very much!

from pyrosar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.