Friday, February 21, 2014

Reading ERS / ASAR Data and Creating Quicklooks

In this previous post it was described how gdal reads Radarsat SAR data. I want to read ERS /ASAR data and create quicklooks for each file.

ERS /ASAR data has different formats, files ending with *.001 , *.E1, *.E2 or *. N1  Gdal can read all these formats, also the *.001 files which not all software reads. For the latter, the "DAT_01.001" is the file to be passed to gdal.

As first step, I create a list containing all files with these endings. I use os.walk to recursively search through all folders:

filelist_CEOS = []
for root, dirnames, filenames in os.walk('Z:\\ERS_Envisat_SAR\\Arctic\\2005'):
  for filename in fnmatch.filter(filenames, 'DAT_01.001'):
      filelist_CEOS.append(os.path.join(root, filename))

filelist_E1E2 = []
for root, dirnames, filenames in os.walk('Z:\\ERS_Envisat_SAR\\Arctic\\2005'):
  for filename in fnmatch.filter(filenames, '*.E1'):
      filelist_E1E2.append(os.path.join(root, filename))      
for root, dirnames, filenames in os.walk('Z:\\ERS_Envisat_SAR\\Arctic\\2005'):
  for filename in fnmatch.filter(filenames, '*.E2'):
      filelist_E1E2.append(os.path.join(root, filename))  
for root, dirnames, filenames in os.walk('Z:\\ERS_Envisat_SAR\\Arctic\\2005'):
  for filename in fnmatch.filter(filenames, '*.N1'):
      filelist_E1E2.append(os.path.join(root, filename)) 

gdalwarp is able to read all of this formats and I can proceed to process all the files from this filelist, calling gdalwarp from within a Python script. This map-projects the raw SAR file and creates a GeoTIFF:


os.system('gdalwarp -tps  -t_srs EPSG:32633 ' + file_from_filelist + ' ' + outputfilename )  


For a small quicklook a convert it to jpeg and make it smaller:
os.system('gdal_translate -of JPEG -ot byte -outsize 20% 20% -scale 0 1000 0 255 ' + outputfilename + ' ' + browseimage )

The whole script reading in all ERS /ASAR images and creating a quicklook can be found here and is hopefully documented well enough.


3 comments:

  1. Hi, Thank you very much for the script. I tried to extract the .E2 file hoping to get wind vectors and wind speed data from ERS.ASPS20.H. But I get this error ERROR 4: `ASPS20_H_110103170900.E2' not recognised as a supported file format. to use it with gdalwarp using the command

    gdalwarp -tps -t_srs EPSG:32633 ASPS20_H_110103170900.E2 test1.geotiff

    Any point on this will be a great help.

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
    2. sorry for the late reply ...

      here is a script with which I create quicklooks from *.E2 files. gdalwarp should work with these files, possibly your file is corrupt?
      https://github.com/npolar/RemoteSensing/blob/1b069afb7d852566a59bdbdf4e17b40b663d66a2/RoutineProcessing/ExtractEnvisatERS.py

      But should not the file-ending of the outputfile be "*.tiff" rather than "*.geotiff" ?

      Delete

      Delete