resampleImage2Match not reading .tif file

69 views
Skip to first unread message

André Beig

unread,
Jan 15, 2018, 6:26:29 PM1/15/18
to RSGISLib Support
Hello everyone, 

I've been trying to use the resampleImage2Match function with ALOS PALSAR images downloaded from ASF and I've been getting an error message saying:

Traceback (most recent call last):
  File "align_teste.py", line 6, in <module>
    rsgislib.imageutils.resampleImage2Match('AP_07629_FBD_F7130_RT1_HH.tif', 'AP_07629_FBD_F7130_RT1_HV.tif', 'AP_07629_FBD_F7130_RT1_aligned_HV.tif', 'GTiff', 'nearestneighbour')
  File "/home/ecodyn/anaconda3/envs/osgeo35/lib/python3.5/site-packages/rsgislib/imageutils/__init__.py", line 281, in resampleImage2Match
    raise Exception("Data type of the input file was not recognised or known.")
Exception: Data type of the input file was not recognised or known.

I have already tried creating a new enviroment and installing RSGISlib from scratch, but it didn't work. Any ideas of what the problem is?

Pete Bunting [pfb]

unread,
Jan 15, 2018, 6:28:40 PM1/15/18
to André Beig, RSGISLib Support

Hi Andre,

 

Could you run gdalinfo on the two files and send the outputs – if gdalinfo can read them OK then rsgislib shouldn’t have a problem.

 

Assume you have checked file paths etc.?

 

Best wishes,


Pete

 

****************************************************
* Dr Pete Bunting
* Reader in Remote Sensing
* Earth Observation and Ecosystem Dynamics Group
* Department of Geography and Earth Sciences
* Aberystwyth University
* Aberystwyth
* Ceredigion
* SY23 3DB
* UK

* Ph: +44 (0) 1970 622615
* Mob: +44 (0) 7917 842743
* Email: p...@aber.ac.uk
* ORCID: http://orcid.org/0000-0002-7435-0148
****************************************************

"Please consider the environment before printing this email or any documents attached”

--
You received this message because you are subscribed to the Google Groups "RSGISLib Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rsgislib-suppo...@googlegroups.com.
To post to this group, send email to rsgislib...@googlegroups.com.
Visit this group at https://groups.google.com/group/rsgislib-support.
For more options, visit https://groups.google.com/d/optout.



--------------------------------------------------------------------
Prifysgol Aberystwyth www.aber.ac.uk
Prifysgol y Flwyddyn ar gyfer Ansawdd Dysgu - The Times & The Sunday Times 2018.

Aberystwyth University www.aber.ac.uk
University of the Year for Teaching Quality - The Times & The Sunday Times 2018.

André Beig

unread,
Jan 16, 2018, 11:29:48 AM1/16/18
to RSGISLib Support
Yes, I figured it could be something wrong with paths, since I was trying to process a large number of images, so I tried it on just one of the many folders I had, which returned the error I posted here. Also, I noticed today that this error message also pops up, before the one I posted earlier:
python align_teste.py 
/home/ecodyn/anaconda3/envs/osgeo35/lib/python3.5/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters

gdalinfo is working, and returns this for the reference image:

gdalinfo AP_07629_FBD_F7130_RT1_HH.tif
Driver: GTiff/GeoTIFF
Files: AP_07629_FBD_F7130_RT1_HH.tif
       AP_07629_FBD_F7130_RT1_HH.tif.aux.xml
Size is 6459, 5813
Coordinate System is:
PROJCS["WGS 84 / UTM zone 19S",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.257223563,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0,
            AUTHORITY["EPSG","8901"]],
        UNIT["degree",0.0174532925199433,
            AUTHORITY["EPSG","9122"]],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",-69],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",10000000],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AXIS["Easting",EAST],
    AXIS["Northing",NORTH],
    AUTHORITY["EPSG","32719"]]
Origin = (845769.750000000000000,9753880.250000000000000)
Pixel Size = (12.500000000000000,-12.500000000000000)
Metadata:
  AREA_OR_POINT=Point
  TIFFTAG_DATETIME=2015:03:03 07:00:16
  TIFFTAG_SOFTWARE=Created with GAMMA Software www.gamma-rs.ch
Image Structure Metadata:
  COMPRESSION=PACKBITS
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  845769.750, 9753880.250) ( 65d53'30.70"W,  2d13'24.30"S)
Lower Left  (  845769.750, 9681217.750) ( 65d53'25.02"W,  2d52'47.39"S)
Upper Right (  926507.250, 9753880.250) ( 65d10' 1.54"W,  2d13'18.13"S)
Lower Right (  926507.250, 9681217.750) ( 65d 9'54.54"W,  2d52'39.39"S)
Center      (  886138.500, 9717549.000) ( 65d31'42.90"W,  2d33' 2.49"S)
Band 1 Block=6459x1 Type=Float32, ColorInterp=Gray
  Min=0.001 Max=3.939 
  Minimum=0.001, Maximum=3.939, Mean=0.269, StdDev=0.212
  NoData Value=0
  Metadata:
    STATISTICS_MAXIMUM=3,9388244152069
    STATISTICS_MEAN=0,26919202648838
    STATISTICS_MINIMUM=0,00064320751698688
    STATISTICS_STDDEV=0,21206979659983

and this for the inImg:

gdalinfo AP_07629_FBD_F7130_RT1_HV.tif
Driver: GTiff/GeoTIFF
Files: AP_07629_FBD_F7130_RT1_HV.tif
       AP_07629_FBD_F7130_RT1_HV.tif.aux.xml
Size is 6459, 5813
Coordinate System is:
PROJCS["WGS 84 / UTM zone 19S",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.257223563,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0,
            AUTHORITY["EPSG","8901"]],
        UNIT["degree",0.0174532925199433,
            AUTHORITY["EPSG","9122"]],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",-69],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",10000000],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AXIS["Easting",EAST],
    AXIS["Northing",NORTH],
    AUTHORITY["EPSG","32719"]]
Origin = (845769.750000000000000,9753880.250000000000000)
Pixel Size = (12.500000000000000,-12.500000000000000)
Metadata:
  AREA_OR_POINT=Point
  TIFFTAG_DATETIME=2015:03:03 07:05:06
  TIFFTAG_SOFTWARE=Created with GAMMA Software www.gamma-rs.ch
Image Structure Metadata:
  COMPRESSION=PACKBITS
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  845769.750, 9753880.250) ( 65d53'30.70"W,  2d13'24.30"S)
Lower Left  (  845769.750, 9681217.750) ( 65d53'25.02"W,  2d52'47.39"S)
Upper Right (  926507.250, 9753880.250) ( 65d10' 1.54"W,  2d13'18.13"S)
Lower Right (  926507.250, 9681217.750) ( 65d 9'54.54"W,  2d52'39.39"S)
Center      (  886138.500, 9717549.000) ( 65d31'42.90"W,  2d33' 2.49"S)
Band 1 Block=6459x1 Type=Float32, ColorInterp=Gray
  Min=0.000 Max=0.733 
  Minimum=0.000, Maximum=0.733, Mean=0.063, StdDev=0.046
  NoData Value=0
  Metadata:
    STATISTICS_MAXIMUM=0,73332637548447
    STATISTICS_MEAN=0,062688143534034
    STATISTICS_MINIMUM=0,0001332757237833
    STATISTICS_STDDEV=0,045792103210061

I'm using Ubuntu 16.04 LTS

To post to this group, send email to rsgisli...@googlegroups.com.

André Beig

unread,
Jan 16, 2018, 11:41:28 AM1/16/18
to RSGISLib Support
I think I figured a way to make it work. Before, I wasn't using the datatype parameter, since both images were Float32, but after I set datatype=9 (which is Float32, right?), it works. Is the datatype parameter necessary for it to work or it could be something else wrong? Anyway, thanks for helping!

Pete Bunting [pfb]

unread,
Jan 16, 2018, 3:43:02 PM1/16/18
to André Beig, RSGISLib Support

HI Andre,

 

Glad you’ve solved this issue. The data types are defined as constants so you should use those rather than the integers, (e.g., rsgislib.TYPE_32FLOAT)

 

  • TYPE_UNDEFINED = 0
  • TYPE_8INT = 1
  • TYPE_16INT = 2
  • TYPE_32INT = 3
  • TYPE_64INT = 4
  • TYPE_8UINT = 5
  • TYPE_16UINT = 6
  • TYPE_32UINT = 7
  • TYPE_64UINT = 8
  • TYPE_32FLOAT = 9
  • TYPE_64FLOAT = 10

 

It should pull the data type directly from the input if you do not redefine it so there is something up here. Can you provide me copying of the imagery so I can test?

To post to this group, send email to rsgislib...@googlegroups.com.

André Beig

unread,
Jan 17, 2018, 11:15:19 AM1/17/18
to RSGISLib Support
Sure, I'll figure a way to upload them to a dropbox or something and post the link here as soon as it's done!

André Beig

unread,
Jan 17, 2018, 11:20:42 AM1/17/18
to RSGISLib Support
https://drive.google.com/drive/folders/1SQvuvg87CwmTpi0pxprsOA32OSthCLZa?usp=sharing

The reference image is the HH image and the input image is the HV, hope this helps, as RSGISlib has been a great tool for me and I'm happy to help, even if it's by finding bugs!!

Pete Bunting [pfb]

unread,
Jan 17, 2018, 11:28:03 PM1/17/18
to André Beig, RSGISLib Support

Thanks Andre,

 

There was a bug there, I have fixed so when the next release it made it will work as you tried to use it. In the meantime, if you specify the output datatype then if will work OK.

 

Best wishes,

 

Pete

 

****************************************************
* Dr Pete Bunting
* Reader in Remote Sensing
* Earth Observation and Ecosystem Dynamics Group
* Department of Geography and Earth Sciences
* Aberystwyth University
* Aberystwyth
* Ceredigion
* SY23 3DB
* UK

* Ph: +44 (0) 1970 622615
* Mob: +44 (0) 7917 842743

To post to this group, send email to rsgislib...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages