X
17180

SARscape PS analyzer tool – How to customize the exported ASCII files

The SARscape PS analyzer tool - /SARscape/General Tools/Time Series Analyzer/Vector- has been developed and customized from the ENVI Spectral profile tool so it can display SARscape PS displacements through time, instead of spectral profiles.

The displacement of a given PS is displayed as follows

  • X-axis displays the date of each acquisition: it corresponds to the date of columns D_YYYYMMDD in the Attribute table of the output PS shapefile
  • Y-axis displays the displacement of the given PS at each of those dates, also available in the Attribute table of output PS shapefile

However only the graphic part is currently customized for PS displacement analysis. If a PS profile is exported using the menu Export > ASCII, the output ASCII file looks confusing:

  • The header is not fully correct as Column 1 is described as Wavelength instead of Time
  • The content of column 1 includes time in Julian format which is not easy to read

 

ENVI ASCII Plot File [Thu Aug 29 09:06:24 2019]

Column 1: Wavelength

Column 2: PS#456~~2##255,0,0

  2452573.000000   4.009981

  2452608.000000   4.856348

  2452643.000000   5.166126

 

Here is a simple IDL code showing how to customize the ASCII file afterwards :

----------------------------------------------------------------------------------------

PRO CONVERT_PS_ASCII_FILE

 

; select the ASCII file generated by the PS process

f=dialog_pickfile(TITLE='Select the ASCII File to be converted')

 

; create the structure to read such ASCII file

sTemplate1 = { $

VERSION : 1.0 , $

DATASTART : 3L, $

DELIMITER : 32B, $

MISSINGVALUE : !VALUES.f_NaN, $

COMMENTSYMBOL : '', $

FIELDCOUNT : 2L, $

FIELDTYPES : [5L,5L], $

FIELDNAMES : ['Time','Velocity'], $

FIELDLOCATIONS : [2L ,19L],$

FIELDGROUPS : [0L,1L] $

  }

; read the ASCII file

data = READ_ASCII(f, HEADER= header,TEMPLATE=stemplate1 )

 

; modify the header

header[1]='Column 1: Time D/M/Y'

header[2]=(strsplit(header[2],'~',/EXTRACT))[0] + ' - Displacement'

 

; convert column 1 from Julian date to DD/YY/YYYY format

CALDAT,data.Time,Month, Day, Year

Data=TRANSPOSE([[Day],[Month],[Year],[data.velocity]])

 

; make an archive of the original ASCII file

FILE_COPY,f,f+"_archive"

 

; save the customized ASCII file using its original filename

OPENW,2,f

Printf,2,TRANSPOSE(header)

Printf,2,data,FORMAT=' %2d/%2d/%d  %f'

close,2

 

END

----------------------------------------------------------------------------------------

 

The output ASCII file created with the above code will now show

  • A relevant header regarding the description of each column
  • A date converted to JJ/DD/YYYY in column 1

Note this code is currently only valid for 1 PS plot but can easily be adapted to ASCII files created from multiple PS plots

 

ENVI ASCII Plot File [Thu Aug 29 09:06:24 2019]

Column 1: Time D/M/Y

Column 2: PS#456 - Displacement

 25/10/2002  4.009981

 29/11/2002  4.856348

  3/ 1/2003  5.166126

 

 

 

----------------------------------------------------------------------------------------

Writen by BC on 19/09/19 - reviwed by MM on 09/19/2019