[Git][debian-gis-team/gmtsar][master] 7 commits: Update d/copyright

Antonio Valentino (@antonio.valentino) gitlab at salsa.debian.org
Sat Jun 29 14:08:03 BST 2024



Antonio Valentino pushed to branch master at Debian GIS Project / gmtsar


Commits:
b917298b by Antonio Valentino at 2024-06-29T13:15:30+02:00
Update d/copyright

- - - - -
876e73f1 by Antonio Valentino at 2024-06-29T13:18:10+02:00
New upstream version 6.5+ds
- - - - -
1a45b9b0 by Antonio Valentino at 2024-06-29T13:18:24+02:00
Update upstream source from tag 'upstream/6.5+ds'

Update to upstream version '6.5+ds'
with Debian dir 5e65d8d7480cea7d215a796e89c1fcbb2602bd68
- - - - -
6c6f766e by Antonio Valentino at 2024-06-29T13:25:03+02:00
New upstream release

- - - - -
eb748f2c by Antonio Valentino at 2024-06-29T13:03:27+00:00
Refresh all patches

- - - - -
468cd334 by Antonio Valentino at 2024-06-29T13:03:36+00:00
Install ext_orb_lt1

- - - - -
07faa3fe by Antonio Valentino at 2024-06-29T13:03:36+00:00
Set distribution to unstable

- - - - -


29 changed files:

- .gitignore
- debian/changelog
- debian/copyright
- debian/gmtsar-core.install
- + debian/man/ext_orb_lt1.1
- debian/man/ext_orb_s1a.1
- debian/patches/0006-LDFLAGS.patch
- gmtsar/csh/baseline_table.csh
- gmtsar/csh/batch_processing.csh
- gmtsar/csh/download_sentinel_orbits.csh
- gmtsar/csh/download_sentinel_orbits_linux.csh
- gmtsar/csh/gnss_enu2los.csh
- gmtsar/csh/organize_files_tops.csh
- gmtsar/csh/organize_files_tops_linux.csh
- gmtsar/csh/p2p_processing.csh
- gmtsar/csh/pop_config.csh
- gmtsar/csh/pre_proc.csh
- − preproc/GF3_preproc/include
- − preproc/GF3_preproc/lib
- preproc/LT1_preproc/Makefile
- − preproc/LT1_preproc/include
- − preproc/LT1_preproc/lib
- preproc/LT1_preproc/src/Makefile
- preproc/LT1_preproc/src/make_slc_lt1.c
- + preproc/LT1_preproc/src_orbit/Makefile
- + preproc/LT1_preproc/src_orbit/ext_orb_lt1.c
- − preproc/NSR_preproc/include
- − preproc/NSR_preproc/lib
- preproc/S1A_preproc/lib/xml.c


Changes:

=====================================
.gitignore
=====================================
@@ -254,3 +254,5 @@ preproc/LT1_preproc/include
 preproc/LT1_preproc/lib
 preproc/LT1_preproc/src/make_slc_lt1
 preproc/LT1_preproc/src/make_slc_lt1.o
+preproc/LT1_preproc/src_orbit/ext_orb_lt1
+preproc/LT1_preproc/src_orbit/ext_orb_lt1.o


=====================================
debian/changelog
=====================================
@@ -1,3 +1,12 @@
+gmtsar (6.5+ds-1) unstable; urgency=medium
+
+  * New upstream release.
+  * debian/patches:
+    - Refresh all patches.
+  * Install "ext_orb_lt1" and the corresponding man page.
+
+ -- Antonio Valentino <antonio.valentino at tiscali.it>  Sat, 29 Jun 2024 11:28:31 +0000
+
 gmtsar (6.4+ds-2) unstable; urgency=medium
 
   * Team upload.


=====================================
debian/copyright
=====================================
@@ -7,44 +7,16 @@ Comment: The upstream release is repacked in order to exclude
 Files-Excluded: .git
                 .github
                 gmtsar/csh/geocode.csh_orig
-                gmtsar/csh/gmtsar_sharedir.csh
                 gmtsar/lib_src/read_data.c_old
                 gmtsar/test_shift/gauss.dat_orig
                 gmtsar/test_shift/test_shift.c_orig
-                preproc/ALOS_preproc/ALOS_fbd2fbs/ALOS_fbd2fbs
-                preproc/ALOS_preproc/ALOS_fbd2fbs_SLC/ALOS_fbd2fbs_SLC
-                preproc/ALOS_preproc/ALOS_fbd2ss/ALOS_fbd2ss
-                preproc/ALOS_preproc/ALOS_merge/ALOS_merge
-                preproc/ALOS_preproc/ALOS_pre_process/ALOS_pre_process
-                preproc/ALOS_preproc/ALOS_pre_process_SLC/ALOS_pre_process_SLC
-                preproc/ALOS_preproc/ALOS_pre_process_SS/ALOS_pre_process_SS
                 preproc/ALOS_preproc/lib_src/Makefile_orig
                 preproc/ALOS_preproc/lib_src/pt0
-                preproc/CSK_preproc/src_raw/make_raw_csk
-                preproc/CSK_preproc/src_slc/make_slc_csk
-                preproc/ENVI_preproc/ASA_CAT/asa_cat
-                preproc/ENVI_preproc/Dop_orbit/calc_dop_orb_envi
-                preproc/ENVI_preproc/ENVI_decode/asa_im_decode
                 preproc/ENVI_preproc/ENVI_SLC_decode/epr_api-2.3
-                preproc/ENVI_preproc/scripts/ENVI_pre_process
-                preproc/ENVI_preproc/scripts/ENVI_SLC_pre_process
-                preproc/ERS_preproc/ers_line_fixer/ers_line_fixer
-                preproc/ERS_preproc/read_data_file_ccrs/read_data_file_ccrs
-                preproc/ERS_preproc/read_data_file_dpaf/read_data_file_dpaf
-                preproc/ERS_preproc/read_sarleader_dpaf/read_sarleader_dpaf
-                preproc/ERS_preproc/scripts/ERS_pre_process
                 preproc/ERS_preproc/scripts/ERS_pre_process_031014
-                preproc/GF3_preproc/src/make_slc_gf3
-                preproc/LT1_preproc/src/make_slc_lt1
-                preproc/NSR_preproc/src_slc/make_slc_nsr
-                preproc/RS2_preproc/src/make_slc_rs2
                 preproc/S1A_preproc/include/include
                 preproc/S1A_preproc/include/lib_defs.h.orig
-                preproc/S1A_preproc/lib/lib
-                preproc/S1A_preproc/src_orbit/ext_orb_s1a
-                preproc/S1A_preproc/src_swath/make_slc_s1a
                 preproc/S1A_preproc/src_tops/Makefile_orig
-                preproc/TSX_preproc/src/make_slc_tsx
                 snaphu
 
 Files: *


=====================================
debian/gmtsar-core.install
=====================================
@@ -23,6 +23,7 @@ usr/bin/envisat_dump_data
 usr/bin/envisat_dump_header
 usr/bin/ers_line_fixer
 usr/bin/esarp
+usr/bin/ext_orb_lt1
 usr/bin/ext_orb_s1a
 usr/bin/extend_orbit
 usr/bin/fitoffset


=====================================
debian/man/ext_orb_lt1.1
=====================================
@@ -0,0 +1,17 @@
+.\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.49.3.
+.TH EXT_ORB_LT1 "1" "June 2024" "ext_orb_lt1 " "User Commands"
+.SH NAME
+ext_orb_lt1 \- Create a .LED file
+.SH SYNOPSIS
+.B ext_orb_lt1
+\fI\,name_of_prm name_of_orb_xml name_output\/\fR
+.SH DESCRIPTION
+Example: ext_orb_lt1 LT1_20230807.PRM LT1B_20240506084320700_V20240315T235500_20240317T000500_ABSORBIT_SCIE.xml output
+.PP
+Output: output.LED
+.PP
+Usage: ext_orb_lt1 name_of_prm name_of_orb_xml name_output
+.PP
+Example: ext_orb_lt1 LT1_20230807.PRM LT1B_20240506084320700_V20240315T235500_20240317T000500_ABSORBIT_SCIE.xml output
+.PP
+Output: output.LED


=====================================
debian/man/ext_orb_s1a.1
=====================================
@@ -1,9 +1,9 @@
 .\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.49.3.
 .TH EXT_ORB_S1A "1" "May 2024" "ext_orb_s1a " "User Commands"
 .SH NAME
-ext_orb_s1a \- ext_orb_s1a
+ext_orb_s1a \- Create a .LED file
 .SH SYNOPSIS
-.B ext_orb_s1a.c
+.B ext_orb_s1a
 \fI\,name_of_prm name_of_orb_xml name_output\/\fR
 .SH DESCRIPTION
 This program is part of GMTSAR.


=====================================
debian/patches/0006-LDFLAGS.patch
=====================================
@@ -9,12 +9,13 @@ Forwarded: https://github.com/gmtsar/gmtsar/pull/923
  preproc/ENVI_preproc/ENVI_SLC_decode/Makefile | 6 +++---
  preproc/GF3_preproc/src/Makefile              | 2 +-
  preproc/LT1_preproc/src/Makefile              | 2 +-
+ preproc/LT1_preproc/src_orbit/Makefile        | 4 ++--
  preproc/NSR_preproc/src_slc/Makefile          | 2 +-
  preproc/RS2_preproc/src/Makefile              | 2 +-
  preproc/S1A_preproc/src_orbit/Makefile        | 2 +-
  preproc/S1A_preproc/src_swath/Makefile        | 2 +-
  preproc/TSX_preproc/src/Makefile              | 2 +-
- 10 files changed, 12 insertions(+), 12 deletions(-)
+ 11 files changed, 14 insertions(+), 14 deletions(-)
 
 diff --git a/preproc/CSK_preproc/src_raw/Makefile b/preproc/CSK_preproc/src_raw/Makefile
 index c60cc36..1095d24 100644
@@ -83,18 +84,40 @@ index 81f93b9..32544e0 100644
  all:	$(PROG)
  
 diff --git a/preproc/LT1_preproc/src/Makefile b/preproc/LT1_preproc/src/Makefile
-index 584dd3a..be372eb 100644
+index 2ae7fe3..d535de4 100644
 --- a/preproc/LT1_preproc/src/Makefile
 +++ b/preproc/LT1_preproc/src/Makefile
-@@ -7,7 +7,7 @@ INCLUDES = -I../include -I../../../gmtsar -I$(TIFF_INC)
- CLIBS = -L../../../gmtsar -lgmtsar -L../lib -lxmlC -L$(TIFF_LIB) -ltiff -lm
+@@ -7,7 +7,7 @@ INCLUDES = -I../include -I../../../gmtsar -I$(TIFF_INC) $(GMT_INC)
+ CLIBS = -L../../../gmtsar -lgmtsar $(GMT_LIB) -L../lib -lxmlC -L$(TIFF_LIB) -ltiff -lm
  
  $(PROG): $(OBJS)
 -	$(CC) $(CFLAGS) -o $@ $(OBJS) $(CLIBS) 
-+	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(CLIBS) 
++	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(CLIBS)
  
  all:	$(PROG)
  
+diff --git a/preproc/LT1_preproc/src_orbit/Makefile b/preproc/LT1_preproc/src_orbit/Makefile
+index 4510617..acb29aa 100644
+--- a/preproc/LT1_preproc/src_orbit/Makefile
++++ b/preproc/LT1_preproc/src_orbit/Makefile
+@@ -7,7 +7,7 @@ INCLUDES = -I../../S1A_preproc/include -I../../../gmtsar -I$(TIFF_INC)
+ CLIBS = -L../../../gmtsar -lgmtsar -L../../S1A_preproc/lib -lxmlC -L$(TIFF_LIB) -ltiff -lm
+ 
+ $(PROG): $(OBJS)
+-	$(CC) $(CFLAGS) -o $@ $(OBJS) $(CLIBS) 
++	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(CLIBS)
+ 
+ all:	$(PROG)
+ 
+@@ -15,7 +15,7 @@ install:
+ 	$(INSTALL) $(PROG) $(bindir)
+ 
+ uninstall:
+-	rm $(bindir)/$(PROG)
++	rm -f $(bindir)/$(PROG)
+ 
+ clean:
+ 	rm -f $(OBJS) tags core
 diff --git a/preproc/NSR_preproc/src_slc/Makefile b/preproc/NSR_preproc/src_slc/Makefile
 index 89d0b68..46c9d2e 100644
 --- a/preproc/NSR_preproc/src_slc/Makefile


=====================================
gmtsar/csh/baseline_table.csh
=====================================
@@ -48,31 +48,41 @@ set ERSSLC = `echo $1|cut -c1-10`
 #
 if ($SSC == 1 || $SSC == 2) then
  SAT_baseline $1 $2 > temp
- @ YR = $T0  / 1000 - 1992
- @ YDAY = $YR * 365 + $DAY
+ set t0 = `echo "" | awk '{print mktime("1992 01 01 00 00 00")}'`
+ @ YR = $T0  / 1000
+ set t1 = `echo "" | awk '{print mktime("'$YR' 01 01 00 00 00")}'`
+ set YDAY = `echo $t0 $t1 | awk '{printf("%d",int(($2-$1)/86400.0+0.5)+'$DAY'-1)}'`
 else if ($SSC == 4 || $SSC == 6) then
  SAT_baseline $1 $2 > temp
- @ YR = $T0  / 1000 - 1992
- @ YDAY = $YR * 365 + $DAY
+ set t0 = `echo "" | awk '{print mktime("1992 01 01 00 00 00")}'`
+ @ YR = $T0  / 1000
+ set t1 = `echo "" | awk '{print mktime("'$YR' 01 01 00 00 00")}'`
+ set YDAY = `echo $t0 $t1 | awk '{printf("%d",int(($2-$1)/86400.0+0.5)+'$DAY'-1)}'`
 else if ($SSC == 5) then
  SAT_baseline $1 $2 > temp
  @ YR1 = $T0 / 1000
  if ($YR1 < 2013) then
-  @ YR = $T0  / 1000 - 2006
+  set t0 = `echo "" | awk '{print mktime("2006 01 01 00 00 00")}'`
  else
-  @ YR = $T0  / 1000 - 2014
+  set t0 = `echo "" | awk '{print mktime("2014 01 01 00 00 00")}'`
  endif
- @ YDAY = $YR * 365 + $DAY
+ @ YR = $T0  / 1000
+ set t1 = `echo "" | awk '{print mktime("'$YR' 01 01 00 00 00")}'`
+ set YDAY = `echo $t0 $t1 | awk '{printf("%d",int(($2-$1)/86400.0+0.5)+'$DAY'-1)}'`
 else
  SAT_baseline $1 $2 > temp
  if ($SSC == 7 || $SSC == 8) then
-  @ YR = $T0 / 1000 - 2007
+  set t0 = `echo "" | awk '{print mktime("2007 01 01 00 00 00")}'`
  else if ($SSC == 9) then
-  @ YR = $T0 / 1000 - 2008
+  set t0 = `echo "" | awk '{print mktime("2008 01 01 00 00 00")}'`
  else if ($SSC == 10) then
-  @ YR = $T0 / 1000 - 2014
+  set t0 = `echo "" | awk '{print mktime("2014 01 01 00 00 00")}'`
+ else
+  set t0 = `echo "" | awk '{print mktime("2020 01 01 00 00 00")}'`
  endif
- @ YDAY = $YR * 365 + $DAY
+ @ YR = $T0  / 1000
+ set t1 = `echo "" | awk '{print mktime("'$YR' 01 01 00 00 00")}'`
+ set YDAY = `echo $t0 $t1 | awk '{printf("%d",int(($2-$1)/86400.0+0.5)+'$DAY')}'`
 endif
 #
 #  get the needed parameters from temp


=====================================
gmtsar/csh/batch_processing.csh
=====================================
@@ -137,6 +137,7 @@
   set SLC_factor = `grep SLC_factor $conf | awk '{print $3}'`
   set near_interp = `grep near_interp $conf | awk '{print $3}'`
   set geometric_coreg = `grep geometric_coreg $conf | awk '{print $3}'`
+  set skip_master = `grep skip_master $conf | awk '{print $3}'`
   set master = ` echo $2`
   set inputlist =  ` echo $3 `
   echo ""
@@ -208,6 +209,7 @@
         #echo "pre_proc.csh $SAT $master $aligned $commandline -skip_master 0"
         #pre_proc.csh $SAT $master $aligned $commandline -skip_master 0
         rm tmp_conf_$aligned
+      
       else
         sed "s/.*proc_stage.*/proc_stage = 1/g" $conf | sed "s/.*skip_stage.*/skip_stage = 2,3,4,5,6/g" | sed "s/.*skip_master.*/skip_master = 1/g" > tmp_conf_$aligned
         p2p_processing.csh $SAT $master $aligned tmp_conf_$aligned
@@ -249,7 +251,7 @@
     echo ""
 
     set ii = 0
-    if ($geometric_coreg == 0 || $SAT == "S1_TOPS" ) then
+    if ($SAT == "S1_TOPS" ) then
       foreach aligned (`cat $inputlist`)
         if ($SAT == "S1_TOPS") then
           set orb = `echo $aligned | awk -F':' '{print $2}'`
@@ -269,10 +271,31 @@
         set ii = `echo $ii | awk '{print $ii+1}'`
       end
     else
-      if ($SAT == "ERS" || $SAT == "ENVI" || $SAT == "ALOS" || $SAT == "CSK_RAW") then
-        align_batch.csh RAW 1 $inputlist
-      else 
-        align_batch.csh SLC 1 $inputlist
+      if ($geometric_coreg == 0) then
+        #if ($SAT == "ERS" || $SAT == "ENVI" || $SAT == "ALOS" || $SAT == "CSK_RAW") then
+        foreach aligned (`cat $inputlist`)
+          if ($ii == 0) then
+            if ($skip_master == 1) then
+              echo "setting skip_master = $skip_master "
+            else
+              sed "s/.*proc_stage.*/proc_stage = 2/g" $conf | sed "s/.*skip_stage.*/skip_stage = 3,4,5,6/g" | sed "s/.*skip_master.*/skip_master = 2/g" > tmp_conf_$aligned
+              p2p_processing.csh $SAT $master $aligned tmp_conf_$aligned
+              rm tmp_conf_$aligned
+            endif
+          else
+            sed  "s/.*proc_stage.*/proc_stage = 2/g" $conf | sed "s/.*skip_stage.*/skip_stage = 3,4,5,6/g" | sed "s/.*skip_master.*/skip_master = 1/g" > tmp_conf_$aligned
+            p2p_processing.csh $SAT $master $aligned tmp_conf_$aligned
+            rm tmp_conf_$aligned
+          endif
+          set ii = `echo $ii | awk '{print $ii+1}'`
+        end
+        #endif
+      else
+        if ($SAT == "ERS" || $SAT == "ENVI" || $SAT == "ALOS" || $SAT == "CSK_RAW") then
+          align_batch.csh RAW 1 $inputlist
+        else
+          align_batch.csh SLC 1 $inputlist
+        endif
       endif
     endif
 


=====================================
gmtsar/csh/download_sentinel_orbits.csh
=====================================
@@ -64,9 +64,14 @@ if ($2 == 1) then
       wget https://step.esa.int/auxdata/orbits/Sentinel-1/$orbittype/$SAT1/$yr/$mo -O tmp_orbit.html
 
       set orbit = `grep $n1 tmp_orbit.html | grep $n2 | awk -F'"' '{print $2}'`
+      if ("x" == $orbit"x") then
+        echo "[ERROR]: No precise orbit exist for date $date1 "
+        exit 1
+      endif
       set file = `echo $orbit | awk '{print substr($1,1,length($1)-4)}'`
 
       if (! -e $file) then
+        echo "Downloading precise orbit $file ..."
         wget https://step.esa.int/auxdata/orbits/Sentinel-1/$orbittype/$SAT1/$yr/$mo/$orbit
         unzip $orbit $file
         rm $orbit
@@ -99,8 +104,8 @@ if ($2 == 2) then
       wget https://step.esa.int/auxdata/orbits/Sentinel-1/$orbittype/$SAT1/$yr/$mo -O tmp_orbit.html
 
       awk -F'"' 'NR>4 {print $2}' tmp_orbit.html | grep $date1 > tmp_orbit.list 
-      set start = `date -v-1H -jf "%Y-%m-%d:%H:%M:%S" $datetime1 +%s`
-      set end = `date -v+1H -jf "%Y-%m-%d:%H:%M:%S" $datetime2 +%s`
+      set start = `date -v-50M -jf "%Y-%m-%d:%H:%M:%S" $datetime1 +%s`
+      set end = `date -v+50M -jf "%Y-%m-%d:%H:%M:%S" $datetime2 +%s`
       foreach rec (`cat tmp_orbit.list`)
 
         set t1 = `echo $rec| awk -F"_" '{printf "%s-%s-%s:%s:%s:%s",substr($7,2,4),substr($7,6,2),substr($7,8,2),substr($7,11,2),substr($7,13,2),substr($7,15,2)}' ` 
@@ -108,10 +113,12 @@ if ($2 == 2) then
         set tstart = `date -jf "%Y-%m-%d:%H:%M:%S" $t1 +%s`
         set tend = `date -jf "%Y-%m-%d:%H:%M:%S" $t2 +%s`
 
-#echo $rec $tstart $start $tend $end
+#echo $rec $tstart $start $tend $end $datetime1 $datetime2 $t1 $t2
+
         set orbit = `echo $rec`
         set file = `echo $orbit | awk '{print substr($1,1,length($1)-4)}'`
         if ($tstart < $start && $tend > $end) then
+          echo "Downloading restituted orbit $file ..."
           if (! -e $file) then
             wget https://step.esa.int/auxdata/orbits/Sentinel-1/$orbittype/$SAT1/$yr/$mo/$orbit
             unzip $orbit $file


=====================================
gmtsar/csh/download_sentinel_orbits_linux.csh
=====================================
@@ -64,9 +64,14 @@ if ($2 == 1) then
       wget https://step.esa.int/auxdata/orbits/Sentinel-1/$orbittype/$SAT1/$yr/$mo -O tmp_orbit.html
 
       set orbit = `grep $n1 tmp_orbit.html | grep $n2 | awk -F'"' '{print $2}'`
+      if ("x" == $orbit"x") then
+        echo "[ERROR]: No precise orbit exist for date $date1 "
+        exit 1
+      endif
       set file = `echo $orbit | awk '{print substr($1,1,length($1)-4)}'`
 
       if (! -e $file) then
+        echo "Downloading precise orbit $file ..."
         wget https://step.esa.int/auxdata/orbits/Sentinel-1/$orbittype/$SAT1/$yr/$mo/$orbit
         unzip $orbit $file
         rm $orbit
@@ -99,8 +104,8 @@ if ($2 == 2) then
       wget https://step.esa.int/auxdata/orbits/Sentinel-1/$orbittype/$SAT1/$yr/$mo -O tmp_orbit.html
 
       awk -F'"' 'NR>4 {print $2}' tmp_orbit.html | grep $date1 > tmp_orbit.list 
-      set start = `date --date="$datetime1 - 1 hour" +%s`
-      set end = `date --date="$datetime2 + 1 hour" +%s`
+      set start = `date --date="$datetime1 - 50 minute" +%s`
+      set end = `date --date="$datetime2 + 50 minute" +%s`
       foreach rec (`cat tmp_orbit.list`)
         set t1 = `echo $rec | awk -F"_" '{printf "%s:%s:%s %s-%s-%s",substr($7,11,2),substr($7,13,2),substr($7,15,2),substr($7,2,4),substr($7,6,2),substr($7,8,2)}' `
         set t2 = `echo $rec | awk -F"_" '{printf "%s:%s:%s %s-%s-%s",substr($8,10,2),substr($8,12,2),substr($8,14,2),substr($8,1,4),substr($8,5,2),substr($8,7,2)}'`
@@ -112,8 +117,8 @@ if ($2 == 2) then
 
         set crita = `echo $tstart $start | awk '{printf("%d",$1/$2)}'`
         set critb = `echo $tend $end | awk '{printf("%d",$1/$2)}'`
-
         if ($crita == 0 && $critb == 1) then
+          echo "Downloading restituted orbit $file ..." 
           if (! -e $file) then
             wget https://step.esa.int/auxdata/orbits/Sentinel-1/$orbittype/$SAT1/$yr/$mo/$orbit
             unzip $orbit $file


=====================================
gmtsar/csh/gnss_enu2los.csh
=====================================
@@ -66,7 +66,7 @@ endif
 # -----------------------------------
 #
 # pull the lon/lat, pull the height, input into SAT_look to get look direction
- awk '{print $2,$3}' $gnssenu | gmt grdtrack -G$dem -N > tmp.llh 
+ awk '{print $2,$3}' $gnssenu | gmt grdtrack -G$dem > tmp.llh 
  SAT_look $PRM < tmp.llh > tmp.lltn
 #
 # -----------------------------------


=====================================
gmtsar/csh/organize_files_tops.csh
=====================================
@@ -88,44 +88,54 @@
         echo "Required orbit file dates: ${n1} to  ${n2}..."
 
         # Format SAFEfile date constraints for ESA database query
-        set startorbtime = ` echo $n1 | awk '{printf "%d-%s-%sT00:00:00.000Z",substr($1,1,4),substr($1,5,2),substr($1,7,2)}' `
-        set endorbtime = ` echo $n2 | awk '{printf "%d-%s-%sT23:59:59.999Z",substr($1,1,4),substr($1,5,2),substr($1,7,2)}' `
+#        set startorbtime = ` echo $n1 | awk '{printf "%d-%s-%sT00:00:00.000Z",substr($1,1,4),substr($1,5,2),substr($1,7,2)}' `
+#        set endorbtime = ` echo $n2 | awk '{printf "%d-%s-%sT23:59:59.999Z",substr($1,1,4),substr($1,5,2),substr($1,7,2)}' `
 
         #echo "Querying ESA POD Hub orbit archive..."
         # Run the query
-        wget --no-check-certificate --user={gnssguest} --password={gnssguest} --output-document=orbitquery.txt "https://scihub.copernicus.eu/gnss/search?q=beginPosition:[${startorbtime} TO ${endorbtime}] AND endPosition:[${startorbtime} TO ${endorbtime}] AND platformname:Sentinel-1 AND filename:${SAT0}_* AND producttype:${orbittype}"
+#        wget --no-check-certificate --user={gnssguest} --password={gnssguest} --output-document=orbitquery.txt "https://scihub.copernicus.eu/gnss/search?q=beginPosition:[${startorbtime} TO ${endorbtime}] AND endPosition:[${startorbtime} TO ${endorbtime}] AND platformname:Sentinel-1 AND filename:${SAT0}_* AND producttype:${orbittype}"
 
-        echo "Checking query for existing orbit file..."
+#        echo "Checking query for existing orbit file..."
 
-        set orbit = ` grep "title" orbitquery.txt | tail -1 | awk '{printf "%s.EOF",substr($1,8,73)}' `
-        set esaID = ` grep "uuid" orbitquery.txt | awk '{print substr($2,13,36)}' `           
-        if (! -f $orbit) then
+#        set orbit = ` grep "title" orbitquery.txt | tail -1 | awk '{printf "%s.EOF",substr($1,8,73)}' `
+#        set esaID = ` grep "uuid" orbitquery.txt | awk '{print substr($2,13,36)}' `           
+#        if (! -f $orbit) then
           # IF esaID is empty that means no uuid was found corresponding to the date window 
-          if (${esaID} == "") then
-            echo "Query Failed -- possible issues:"
-            echo " - an orbit file for those dates may not exist yet"
-            echo "     --> check the resistited orbit files (AUX_RESORB) "
-            echo ""
-            echo " SKIP $date0, as precise orbit file may not exist ..."
-            echo ""
-            echo $file1 > tmprecord
-            set file0 = `echo $file1`
-            set date0 = `echo $date1`
-            set SAT0 = `echo $SAT1`
-            continue
-          else
-            if (-f $orb_dir/$SAT0/$orbit) then
-              ln -s $orb_dir/$SAT0/$orbit
-            else
-              echo "Query successful -- downloading orbit file..."
-              wget --content-disposition --continue --user={gnssguest} --password={gnssguest} "https://scihub.copernicus.eu/gnss/odata/v1/Products('${esaID}')/"`echo '$'`"value"
-              echo "...orbit file ${orbit} downloaded"
-            endif
-          endif  
-        else  
-          echo "...orbit file already exists..."
-          echo " "
+#          if (${esaID} == "") then
+#            echo "Query Failed -- possible issues:"
+#            echo " - an orbit file for those dates may not exist yet"
+#            echo "     --> check the resistited orbit files (AUX_RESORB) "
+#            echo ""
+#            echo " SKIP $date0, as precise orbit file may not exist ..."
+#            echo ""
+#            echo $file1 > tmprecord
+#            set file0 = `echo $file1`
+#            set date0 = `echo $date1`
+#            set SAT0 = `echo $SAT1`
+#            continue
+#          else
+#            if (-f $orb_dir/$SAT0/$orbit) then
+#              ln -s $orb_dir/$SAT0/$orbit
+#            else
+#              echo "Query successful -- downloading orbit file..."
+#              wget --content-disposition --continue --user={gnssguest} --password={gnssguest} "https://scihub.copernicus.eu/gnss/odata/v1/Products('${esaID}')/"`echo '$'`"value"
+#              echo "...orbit file ${orbit} downloaded"
+#            endif
+#          endif  
+#        else  
+#          echo "...orbit file already exists..."
+#          echo " "
+#        endif
+
+        cat tmprecord | awk 'NR==1{print $1}' > tmp_safelist
+        download_sentinel_orbits.csh tmp_safelist 1
+        set orbit = `ls *EOF | grep $n1 | grep $n2 | tail -1`
+        if ("x" == $orbit"x") then
+          download_sentinel_orbits.csh tmp_safelist 2 > tmp_download_log
+          set orbit = `grep "restituted" tmp_download_log | awk '{print $4}'`
         endif
+        echo "Downloaded orbit file $orbit"
+        rm tmp_safelist tmp_download_log
 
         # compute azimuth for the start and end 
         set pin1 = `head -1 $2 | awk '{print $1,$2}'` 
@@ -216,40 +226,49 @@
   echo "Required orbit file dates: ${n1} to  ${n2}..."
 
   # Format SAFEfile date constraints for ESA database query
-  set startorbtime = ` echo $n1 | awk '{printf "%d-%s-%sT00:00:00.000Z",substr($1,1,4),substr($1,5,2),substr($1,7,2)}' `
-  set endorbtime = ` echo $n2 | awk '{printf "%d-%s-%sT23:59:59.999Z",substr($1,1,4),substr($1,5,2),substr($1,7,2)}' `
+#  set startorbtime = ` echo $n1 | awk '{printf "%d-%s-%sT00:00:00.000Z",substr($1,1,4),substr($1,5,2),substr($1,7,2)}' `
+#  set endorbtime = ` echo $n2 | awk '{printf "%d-%s-%sT23:59:59.999Z",substr($1,1,4),substr($1,5,2),substr($1,7,2)}' `
 
   # Run the query
-  wget --no-check-certificate --user={gnssguest} --password={gnssguest} --output-document=orbitquery.txt "https://scihub.copernicus.eu/gnss/search?q=beginPosition:[${startorbtime} TO ${endorbtime}] AND endPosition:[${startorbtime} TO ${endorbtime}] AND platformname:Sentinel-1 AND filename:${SAT0}_* AND producttype:${orbittype}"
+#  wget --no-check-certificate --user={gnssguest} --password={gnssguest} --output-document=orbitquery.txt "https://scihub.copernicus.eu/gnss/search?q=beginPosition:[${startorbtime} TO ${endorbtime}] AND endPosition:[${startorbtime} TO ${endorbtime}] AND platformname:Sentinel-1 AND filename:${SAT0}_* AND producttype:${orbittype}"
 
-  echo "Checking query for existing orbit file..."
+#  echo "Checking query for existing orbit file..."
       
-  set orbit = ` grep "title" orbitquery.txt | tail -1 | awk '{printf "%s.EOF",substr($1,8,73)}' `
-  set esaID = ` grep "uuid" orbitquery.txt | awk '{print substr($2,13,36)}' `           
-  if (! -f $orbit) then
+#  set orbit = ` grep "title" orbitquery.txt | tail -1 | awk '{printf "%s.EOF",substr($1,8,73)}' `
+#  set esaID = ` grep "uuid" orbitquery.txt | awk '{print substr($2,13,36)}' `           
+#  if (! -f $orbit) then
     # IF esaID is empty that means no uuid was found corresponding to the date window 
-    if (${esaID} == "") then
-      echo "Query Failed -- possible issues:"
-      echo " - an orbit file for those dates may not exist yet"
-      echo "     --> check the resistited orbit files (AUX_RESORB)"
-      echo ""
-      echo " SKIP $date0, as precise orbit file may not exist ..."
-      echo ""
-      exit 1  
-    else
-      if (-f $orb_dir/$SAT0/$orbit) then
-        ln -s $orb_dir/$SAT0/$orbit
-      else
-        echo "Query successful -- downloading orbit file..."
-        wget --content-disposition --continue --user={gnssguest} --password={gnssguest} "https://scihub.copernicus.eu/gnss/odata/v1/Products('${esaID}')/"`echo '$'`"value"
-        echo "...orbit file ${orbit} downloaded"
-      endif
-    endif  
-  else  
-    echo "...orbit file already exists..."
-    echo " "
-  endif
+#    if (${esaID} == "") then
+#      echo "Query Failed -- possible issues:"
+#      echo " - an orbit file for those dates may not exist yet"
+#      echo "     --> check the resistited orbit files (AUX_RESORB)"
+#      echo ""
+#      echo " SKIP $date0, as precise orbit file may not exist ..."
+#      echo ""
+#      exit 1  
+#    else
+#      if (-f $orb_dir/$SAT0/$orbit) then
+#        ln -s $orb_dir/$SAT0/$orbit
+#      else
+#        echo "Query successful -- downloading orbit file..."
+#        wget --content-disposition --continue --user={gnssguest} --password={gnssguest} "https://scihub.copernicus.eu/gnss/odata/v1/Products('${esaID}')/"`echo '$'`"value"
+#        echo "...orbit file ${orbit} downloaded"
+#      endif
+#    endif  
+#  else  
+#    echo "...orbit file already exists..."
+#    echo " "
+#  endif
 
+  cat tmprecord | awk 'NR==1{print $1}' > tmp_safelist
+  download_sentinel_orbits.csh tmp_safelist 1
+  set orbit = `ls *EOF | grep $n1 | grep $n2 | tail -1`
+  if ("x" == $orbit"x") then
+    download_sentinel_orbits.csh tmp_safelist 2 > tmp_download_log
+    set orbit = `grep "restituted" tmp_download_log | awk '{print $4}'`
+  endif
+  echo "Downloaded orbit file $orbit"
+  rm tmp_safelist tmp_download_log
 
   # check the start and the end, make sure the start comes later than the first line of the first file and the end comes before the last line of the last file
   set pin1 = `head -1 $2 | awk '{print $1,$2}'` 


=====================================
gmtsar/csh/organize_files_tops_linux.csh
=====================================
@@ -98,44 +98,54 @@
         echo "Required orbit file dates: ${n1} to  ${n2}..."
 
         # Format SAFEfile date constraints for ESA database query
-        set startorbtime = ` echo $n1 | awk '{printf "%d-%s-%sT00:00:00.000Z",substr($1,1,4),substr($1,5,2),substr($1,7,2)}' `
-        set endorbtime = ` echo $n2 | awk '{printf "%d-%s-%sT23:59:59.999Z",substr($1,1,4),substr($1,5,2),substr($1,7,2)}' `
+#        set startorbtime = ` echo $n1 | awk '{printf "%d-%s-%sT00:00:00.000Z",substr($1,1,4),substr($1,5,2),substr($1,7,2)}' `
+#        set endorbtime = ` echo $n2 | awk '{printf "%d-%s-%sT23:59:59.999Z",substr($1,1,4),substr($1,5,2),substr($1,7,2)}' `
 
         #echo "Querying ESA POD Hub orbit archive..."
         # Run the query
-        wget --no-check-certificate --user={gnssguest} --password={gnssguest} --output-document=orbitquery.txt "https://scihub.copernicus.eu/gnss/search?q=beginPosition:[${startorbtime} TO ${endorbtime}] AND endPosition:[${startorbtime} TO ${endorbtime}] AND platformname:Sentinel-1 AND filename:${SAT0}_* AND producttype:${orbittype}"
+#        wget --no-check-certificate --user={gnssguest} --password={gnssguest} --output-document=orbitquery.txt "https://scihub.copernicus.eu/gnss/search?q=beginPosition:[${startorbtime} TO ${endorbtime}] AND endPosition:[${startorbtime} TO ${endorbtime}] AND platformname:Sentinel-1 AND filename:${SAT0}_* AND producttype:${orbittype}"
 
-        echo "Checking query for existing orbit file..."
+#        echo "Checking query for existing orbit file..."
 
-        set orbit = ` grep "title" orbitquery.txt | tail -1 | awk '{printf "%s.EOF",substr($1,8,73)}' `
-        set esaID = ` grep "uuid" orbitquery.txt | awk '{print substr($2,13,36)}' `           
-        if (! -f $orbit) then
+#        set orbit = ` grep "title" orbitquery.txt | tail -1 | awk '{printf "%s.EOF",substr($1,8,73)}' `
+#        set esaID = ` grep "uuid" orbitquery.txt | awk '{print substr($2,13,36)}' `           
+#        if (! -f $orbit) then
           ### IF esaID is empty that means no uuid was found corresponding to the date window ###
-          if (${esaID} == "") then
-            echo "Query Failed -- possible issues:"
-            echo " - an orbit file for those dates may not exist yet"
-            echo "     --> check the resistited orbit files (AUX_RESORB) "
-            echo ""
-            echo " SKIP $date0, as precise orbit file may not exist ..."
-            echo ""
-            echo $file1 > tmprecord
-            set file0 = `echo $file1`
-            set date0 = `echo $date1`
-            set SAT0 = `echo $SAT1`
-            continue
-          else
-            if (-f $orb_dir/$SAT0/$orbit) then
-              ln -s $orb_dir/$SAT0/$orbit
-            else
-              echo "Query successful -- downloading orbit file..."
-              wget --content-disposition --continue --user={gnssguest} --password={gnssguest} "https://scihub.copernicus.eu/gnss/odata/v1/Products('${esaID}')/"`echo '$'`"value"
-              echo "...orbit file ${orbit} downloaded"
-            endif
-          endif  
-        else  
-          echo "...orbit file already exists..."
-          echo " "
+#          if (${esaID} == "") then
+#            echo "Query Failed -- possible issues:"
+#            echo " - an orbit file for those dates may not exist yet"
+#            echo "     --> check the resistited orbit files (AUX_RESORB) "
+#            echo ""
+#            echo " SKIP $date0, as precise orbit file may not exist ..."
+#            echo ""
+#            echo $file1 > tmprecord
+#            set file0 = `echo $file1`
+#            set date0 = `echo $date1`
+#            set SAT0 = `echo $SAT1`
+#            continue
+#          else
+#            if (-f $orb_dir/$SAT0/$orbit) then
+#              ln -s $orb_dir/$SAT0/$orbit
+#            else
+#              echo "Query successful -- downloading orbit file..."
+#              wget --content-disposition --continue --user={gnssguest} --password={gnssguest} "https://scihub.copernicus.eu/gnss/odata/v1/Products('${esaID}')/"`echo '$'`"value"
+#              echo "...orbit file ${orbit} downloaded"
+#            endif
+#          endif  
+#        else  
+#          echo "...orbit file already exists..."
+#          echo " "
+#        endif
+
+        cat tmprecord | awk 'NR==1{print $1}' > tmp_safelist
+        download_sentinel_orbits_linux.csh tmp_safelist 1
+        set orbit = `ls *EOF | grep $n1 | grep $n2 | tail -1` 
+        if ("x" == $orbit"x") then
+          download_sentinel_orbits_linux.csh tmp_safelist 2 > tmp_download_log
+          set orbit = `grep "restituted" tmp_download_log | awk '{print $4}'`
         endif
+        echo "Downloaded orbit file $orbit"
+        rm tmp_safelist tmp_download_log
 
         # compute azimuth for the start and end 
         set pin1 = `head -1 $2 | awk '{print $1,$2}'` 
@@ -235,39 +245,49 @@
   echo "Required orbit file dates: ${n1} to  ${n2}..."
 
   # Format SAFEfile date constraints for ESA database query
-  set startorbtime = ` echo $n1 | awk '{printf "%d-%s-%sT00:00:00.000Z",substr($1,1,4),substr($1,5,2),substr($1,7,2)}' `
-  set endorbtime = ` echo $n2 | awk '{printf "%d-%s-%sT23:59:59.999Z",substr($1,1,4),substr($1,5,2),substr($1,7,2)}' `
+#  set startorbtime = ` echo $n1 | awk '{printf "%d-%s-%sT00:00:00.000Z",substr($1,1,4),substr($1,5,2),substr($1,7,2)}' `
+#  set endorbtime = ` echo $n2 | awk '{printf "%d-%s-%sT23:59:59.999Z",substr($1,1,4),substr($1,5,2),substr($1,7,2)}' `
 
   # Run the query
-  wget --no-check-certificate --user={gnssguest} --password={gnssguest} --output-document=orbitquery.txt "https://scihub.copernicus.eu/gnss/search?q=beginPosition:[${startorbtime} TO ${endorbtime}] AND endPosition:[${startorbtime} TO ${endorbtime}] AND platformname:Sentinel-1 AND filename:${SAT0}_* AND producttype:${orbittype}"
+#  wget --no-check-certificate --user={gnssguest} --password={gnssguest} --output-document=orbitquery.txt "https://scihub.copernicus.eu/gnss/search?q=beginPosition:[${startorbtime} TO ${endorbtime}] AND endPosition:[${startorbtime} TO ${endorbtime}] AND platformname:Sentinel-1 AND filename:${SAT0}_* AND producttype:${orbittype}"
 
-  echo "Checking query for existing orbit file..."
+#  echo "Checking query for existing orbit file..."
 
-  set orbit = ` grep "title" orbitquery.txt | tail -1 | awk '{printf "%s.EOF",substr($1,8,73)}' `
-  set esaID = ` grep "uuid" orbitquery.txt | awk '{print substr($2,13,36)}' `           
-  if (! -f $orbit) then
+#  set orbit = ` grep "title" orbitquery.txt | tail -1 | awk '{printf "%s.EOF",substr($1,8,73)}' `
+#  set esaID = ` grep "uuid" orbitquery.txt | awk '{print substr($2,13,36)}' `           
+#  if (! -f $orbit) then
     ### IF esaID is empty that means no uuid was found corresponding to the date window ###
-    if (${esaID} == "") then
-      echo "Query Failed -- possible issues:"
-      echo " - an orbit file for those dates may not exist yet"
-      echo "     --> check the resistited orbit files (AUX_RESORB)  "
-      echo ""
-      echo " SKIP $date0, as precise orbit file may not exist ..."
-      echo ""
-      exit 1  
-    else
-      if (-f $orb_dir/$SAT0/$orbit) then
-        ln -s $orb_dir/$SAT0/$orbit
-      else
-        echo "Query successful -- downloading orbit file..."
-        wget --content-disposition --continue --user={gnssguest} --password={gnssguest} "https://scihub.copernicus.eu/gnss/odata/v1/Products('${esaID}')/"`echo '$'`"value"
-        echo "...orbit file ${orbit} downloaded"
-      endif
-    endif  
-  else  
-    echo "...orbit file already exists..."
-    echo " "
+#    if (${esaID} == "") then
+#      echo "Query Failed -- possible issues:"
+#      echo " - an orbit file for those dates may not exist yet"
+#      echo "     --> check the resistited orbit files (AUX_RESORB)  "
+#      echo ""
+#      echo " SKIP $date0, as precise orbit file may not exist ..."
+#      echo ""
+#      exit 1  
+#    else
+#      if (-f $orb_dir/$SAT0/$orbit) then
+#        ln -s $orb_dir/$SAT0/$orbit
+#      else
+#        echo "Query successful -- downloading orbit file..."
+#        wget --content-disposition --continue --user={gnssguest} --password={gnssguest} "https://scihub.copernicus.eu/gnss/odata/v1/Products('${esaID}')/"`echo '$'`"value"
+#        echo "...orbit file ${orbit} downloaded"
+#      endif
+#    endif  
+#  else  
+#    echo "...orbit file already exists..."
+#    echo " "
+#  endif
+
+  cat tmprecord | awk 'NR==1{print $1}' > tmp_safelist
+  download_sentinel_orbits_linux.csh tmp_safelist 1
+  set orbit = `ls *EOF | grep $n1 | grep $n2 | tail -1` 
+  if ("x" == $orbit"x") then
+    download_sentinel_orbits_linux.csh tmp_safelist 2 > tmp_download_log
+    set orbit = `grep "restituted" tmp_download_log | awk '{print $4}'`
   endif
+  echo "Downloaded orbit file $orbit"
+  rm tmp_safelist tmp_download_log
 
   # check the start and the end, make sure the start comes later than the first line of the first file and the end comes before the last line of the last file
   set pin1 = `head -1 $2 | awk '{print $1,$2}'` 


=====================================
gmtsar/csh/p2p_processing.csh
=====================================
@@ -508,7 +508,7 @@
           set amin = `echo $amedian | awk '{print $1-3}'`
           awk '{if($4 > '$amin' && $4 < '$amax') print $0}' < freq_xcorr.dat > freq_alos2.dat
           fitoffset.csh 2 3 freq_alos2.dat 10 >> $aligned.PRM
-        else if ($SAT == "ERS" || $SAT == "ENVI" || $SAT == "ALOS" || $SAT == "CSK_RAW") then
+        else if ($SAT == "ERS" || $SAT == "ENVI" || $SAT == "ALOS" || $SAT == "CSK_RAW" || $SAT == "LT1") then
           xcorr $master.PRM $aligned.PRM -xsearch 128 -ysearch 128 -nx 20 -ny 50
           fitoffset.csh 3 3 freq_xcorr.dat 18 >> $aligned.PRM
         else


=====================================
gmtsar/csh/pop_config.csh
=====================================
@@ -69,11 +69,11 @@ if ($SAT == "S1_TOPS") then
   echo "spec_mode = 1"
 endif
 
-if ($SAT == "ALOS_SLC" || $SAT == "ALOS2") then
+if ($SAT == "ALOS_SLC") then
   echo "# SLC scale factor to convert float to int "
   echo "SLC_factor = 0.02"
   echo ""
-else if ($SAT == "ALOS2_SCAN") then
+else if ($SAT == "ALOS2_SCAN" || $SAT == "ALOS2") then
   echo "# SLC scale factor to convert float to int"
   echo "SLC_factor = 2.0"
   echo ""
@@ -81,6 +81,10 @@ else if ($SAT == "CSK_SLC") then
   echo "# SLC scale factor to convert float to int"
   echo "SLC_factor = 1.0"
   echo ""
+else if ($SAT == "LT1") then
+  echo "# SLC scale factor to convert float to int"
+  echo "SLC_factor = 10.0"
+  echo ""
 endif
 
 echo "################################################"


=====================================
gmtsar/csh/pre_proc.csh
=====================================
@@ -461,10 +461,18 @@ echo $commandline
       endif
     else if ($SAT == "LT1") then
       if ($skip_master == 0 || $skip_master == 2) then
-        make_slc_lt1 $master.xml $master.tiff $master
+        if ($SLC_factor == 0) then
+          make_slc_lt1 $master.xml $master.tiff $master
+        else 
+          make_slc_lt1 $master.xml $master.tiff $master $SLC_factor
+        endif
       endif
       if ($skip_master == 0 || $skip_master == 1) then
-        make_slc_lt1 $aligned.xml $aligned.tiff $aligned
+        if ($SLC_factor == 0) then
+          make_slc_lt1 $aligned.xml $aligned.tiff $aligned
+        else
+          make_slc_lt1 $aligned.xml $aligned.tiff $aligned $SLC_factor
+        endif
       endif
     else 
       if ($skip_master == 0 || $skip_master == 2) then


=====================================
preproc/GF3_preproc/include deleted
=====================================
@@ -1 +0,0 @@
-../S1A_preproc/include
\ No newline at end of file


=====================================
preproc/GF3_preproc/lib deleted
=====================================
@@ -1 +0,0 @@
-../S1A_preproc/lib
\ No newline at end of file


=====================================
preproc/LT1_preproc/Makefile
=====================================
@@ -2,7 +2,7 @@ include ../../config.mk
 #
 #   make all the files
 #
-DIRS	= lib src
+DIRS	= src src_orbit
 
 all:
 	$(LN_S) -f ../S1A_preproc/include include


=====================================
preproc/LT1_preproc/include deleted
=====================================
@@ -1 +0,0 @@
-../S1A_preproc/include
\ No newline at end of file


=====================================
preproc/LT1_preproc/lib deleted
=====================================
@@ -1 +0,0 @@
-../S1A_preproc/lib
\ No newline at end of file


=====================================
preproc/LT1_preproc/src/Makefile
=====================================
@@ -3,8 +3,8 @@ PROG =  make_slc_lt1
 CSRCS = make_slc_lt1.c
 
 OBJS =  $(CSRCS:.c=.o)
-INCLUDES = -I../include -I../../../gmtsar -I$(TIFF_INC)
-CLIBS = -L../../../gmtsar -lgmtsar -L../lib -lxmlC -L$(TIFF_LIB) -ltiff -lm
+INCLUDES = -I../include -I../../../gmtsar -I$(TIFF_INC) $(GMT_INC)
+CLIBS = -L../../../gmtsar -lgmtsar $(GMT_LIB) -L../lib -lxmlC -L$(TIFF_LIB) -ltiff -lm
 
 $(PROG): $(OBJS)
 	$(CC) $(CFLAGS) -o $@ $(OBJS) $(CLIBS) 


=====================================
preproc/LT1_preproc/src/make_slc_lt1.c
=====================================
@@ -12,21 +12,23 @@
  ***************************************************************************/
 
 #include "PRM.h"
-#include "lib_defs.h"
-#include "lib_functions.h"
-#include "stateV.h"
-#include "tiffio.h"
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include "ctype.h" 
+#include "gmtsar.h" 
+#include "lib_defs.h" 
+#include "lib_functions.h" 
+#include "stateV.h" 
+#include "tiffio.h" 
+#include <math.h> 
+#include <stdio.h> 
+#include <stdlib.h> 
+#include <string.h> 
 
 int pop_prm(struct PRM *, tree *, char *);
 int pop_led(tree *, state_vector *);
 int write_orb(state_vector *sv, FILE *fp, int);
-int write_slc(TIFF *, FILE *, char *);
+int write_slc(TIFF *, FILE *, char *, double);
 
-char *USAGE = "\nUsage: make_slc_lt1 name_of_xml_file name_of_tiff_file name_output\n"
+char *USAGE = "\nUsage: make_slc_lt1 name_of_xml_file name_of_tiff_file name_output [SLC_factor]\n"
               "\nExample: make_slc_lt1 LT1A_MONO_KSC_STRIP2_006353_E112.2_N33.4_20230328_SLC_HH_S2A_0000087472.meta.xml LT1A_MONO_KSC_STRIP2_006353_E112.2_N33.4_20230328_SLC_HH_S2A_0000087472.tiff LT1A_20230328\n"
               "\nOutput: LT1A_20230328.SLC LT1A_20230328.PRM LT1A_20230328.LED\n";
 
@@ -39,9 +41,15 @@ int main(int argc, char **argv) {
 	tree *xml_tree;
 	state_vector sv[2000];
 	int ch, n = 0, nc = 0, nlmx = 0;
+    double SLC_factor = 1.0;
 
 	if (argc < 4)
 		die(USAGE, "");
+    
+    if (argc == 5) {
+        SLC_factor = atof(argv[4]);
+        printf("Setting SLC_factor to %.2f\n", SLC_factor);
+    }
 
 	if ((XML_FILE = fopen(argv[1], "rb")) == NULL)
 		die("Couldn't open xml file: \n", argv[1]);
@@ -98,19 +106,20 @@ int main(int argc, char **argv) {
 	strcat(tmp_str, ".SLC");
 	if ((OUTPUT_SLC = fopen(tmp_str, "wb")) == NULL)
 		die("Couldn't open slc file: \n", tmp_str);
-	write_slc(TIFF_FILE, OUTPUT_SLC, prm.orbdir);
+	write_slc(TIFF_FILE, OUTPUT_SLC, prm.orbdir, SLC_factor);
 
 	TIFFClose(TIFF_FILE);
 	fclose(OUTPUT_SLC);
 }
 
-int write_slc(TIFF *tif, FILE *slc, char *orbdir) {
+int write_slc(TIFF *tif, FILE *slc, char *orbdir, double SLC_factor) {
 
 	uint32 width, height, widthi;
 	int i, j;
 	uint16 s = 0, nsamples;
 	uint16 *buf;
 	short *tmp;
+    int nclip=0;
 
 	// get the width and the height of the file, make width dividable by 4
 	TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &widthi);
@@ -125,10 +134,19 @@ int write_slc(TIFF *tif, FILE *slc, char *orbdir) {
     for (i = 0; i < height; i++) {
     	TIFFReadScanline(tif, buf, i, s);
 		for (j = 0; j < width * 2; j++) {
-				tmp[j] = (short)buf[j];
+            if (SLC_factor == 1.0) {
+                tmp[j] = (short)buf[j];
+            }
+            else {
+                if ((int)((short)buf[j]*SLC_factor) > I2MAX)
+                    nclip++;
+		        tmp[j] = (short)clipi2((short)buf[j]*SLC_factor);
+            }
+
 		}
 		fwrite(tmp, sizeof(short), width * 2, slc);
     }
+    printf("Number of clipped short int is %d\n",nclip);
 /*
 	if (strcmp(orbdir, "A") == 0) {
 		printf("Fliping upside down for Ascending Image...\n");


=====================================
preproc/LT1_preproc/src_orbit/Makefile
=====================================
@@ -0,0 +1,21 @@
+include ../../../config.mk
+PROG =  ext_orb_lt1
+CSRCS = ext_orb_lt1.c
+
+OBJS =  $(CSRCS:.c=.o)
+INCLUDES = -I../../S1A_preproc/include -I../../../gmtsar -I$(TIFF_INC)
+CLIBS = -L../../../gmtsar -lgmtsar -L../../S1A_preproc/lib -lxmlC -L$(TIFF_LIB) -ltiff -lm
+
+$(PROG): $(OBJS)
+	$(CC) $(CFLAGS) -o $@ $(OBJS) $(CLIBS) 
+
+all:	$(PROG)
+
+install:
+	$(INSTALL) $(PROG) $(bindir)
+
+uninstall:
+	rm $(bindir)/$(PROG)
+
+clean:
+	rm -f $(OBJS) tags core


=====================================
preproc/LT1_preproc/src_orbit/ext_orb_lt1.c
=====================================
@@ -0,0 +1,184 @@
+/***************************************************************************
+ * Creator:  Xiaohua XU                                                    *
+ *           (University of Science and Technology of China)               *
+ * Date   :  06/03/2024                                                    *
+ ***************************************************************************/
+
+/***************************************************************************
+ * Modification history:                                                   *
+ *                                                                         *
+ * DATE   :                                                                *
+ *                                                                         *
+ ***************************************************************************/
+
+#include "PRM.h"
+#include "lib_defs.h"
+#include "lib_functions.h"
+#include "stateV.h"
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+// int pop_prm(struct PRM *, tree *, char *);
+int pop_led_pre(tree *, state_vector *, double, double);
+int write_orb(state_vector *sv, FILE *fp, int);
+double yds2ydf(state_vector);
+
+char *USAGE = "\n\nUsage: ext_orb_lt1 name_of_prm name_of_orb_xml name_output\n"
+              "\nExample: ext_orb_lt1 LT1_20230807.PRM "
+              "LT1B_20240506084320700_V20240315T235500_20240317T000500_ABSORBIT_SCIE"
+              ".xml output\n"
+              "\nOutput: output.LED\n";
+
+int main(int argc, char **argv) {
+
+	FILE *XML_FILE, *INPUT_PRM, *OUTPUT_LED;
+	char tmp_str[200];
+	struct PRM prm;
+	tree *xml_tree;
+	state_vector *sv;
+	int ch, n = 0, nc = 0, nlmx = 0;
+	double t1, t2;
+
+	if (argc < 3)
+		die(USAGE, "");
+
+	// find the number of lines and the maximum line length of the xml file
+	if ((XML_FILE = fopen(argv[2], "r")) == NULL)
+		die("Couldn't open xml file: \n", argv[2]);
+	while (EOF != (ch = fgetc(XML_FILE))) {
+		++nc;
+		if (ch == '\n') {
+			++n;
+			if (nc > nlmx)
+				nlmx = nc;
+			nc = 0;
+		}
+	}
+	xml_tree = (struct tree *)malloc(5 * n * sizeof(struct tree));
+	sv = (struct state_vector *)malloc(n / 2 * sizeof(struct state_vector));
+	fclose(XML_FILE);
+
+	if ((XML_FILE = fopen(argv[2], "r")) == NULL)
+		die("Couldn't open xml file: \n", argv[2]);
+	get_tree(XML_FILE, xml_tree, 1);
+	// show_tree(xml_tree,0,0);
+	fclose(XML_FILE);
+
+	// get the prm
+	if ((INPUT_PRM = fopen(argv[1], "r")) == NULL)
+		die("Couldn't open xml file: \n", argv[1]);
+	get_sio_struct(INPUT_PRM, &prm);
+	// fprintf(stderr,"%.12f  %.12f\n",prm.SC_clock_start,prm.SC_clock_stop);
+    // revising t1 and t2 in case only one burst is used.
+    // if smaller than 2 burst, extract more
+	//t1 = prm.SC_clock_start - 10 * (prm.SC_clock_stop - prm.SC_clock_start);
+	//t2 = prm.SC_clock_stop + 10 * (prm.SC_clock_stop - prm.SC_clock_start);
+	t1 = prm.SC_clock_start - 200.0/86400.0;
+	t2 = prm.SC_clock_stop +  200.0/86400.0;
+//    if (fabs(t2-t1) < 1/86400.0*150) {
+//        t1 = prm.SC_clock_start - 20 * (prm.SC_clock_stop - prm.SC_clock_start);
+//        t2 = prm.SC_clock_stop + 20 * (prm.SC_clock_stop - prm.SC_clock_start);
+//    }
+
+	// generate the LED file
+	n = pop_led_pre(xml_tree, sv, t1, t2);
+
+	strcpy(tmp_str, argv[3]);
+	strcat(tmp_str, ".LED");
+	if ((OUTPUT_LED = fopen(tmp_str, "w")) == NULL)
+		die("Couldn't open led file: \n", tmp_str);
+	// tmp_str = search_tree()
+	write_orb(sv, OUTPUT_LED, n);
+	fclose(OUTPUT_LED);
+	free(xml_tree);
+	free(sv);
+}
+
+int write_orb(state_vector *sv, FILE *fp, int n) {
+	int i;
+	double dt;
+
+	if (n <= 0) {
+		fprintf(stderr, "[ERROR]: NO orbit coverage in the selected file...\n");
+		return (-1);
+	}
+	else {
+		printf("Writing %d lines of precise orbit for the LED file...\n", n);
+	}
+
+	dt = round((sv[1].sec) * 1000.0) / 1000.0 - round((sv[0].sec) * 1000.0) / 1000.0;
+	// printf("%f,%f\n",sv[1].sec,sv[0].sec);
+	if (n <= 1)
+		return (-1);
+	fprintf(fp, "%d %d %d %.6lf %.3lf \n", n, sv[0].yr, sv[0].jd, sv[0].sec, dt);
+	for (i = 0; i < n; i++) {
+		fprintf(fp, "%d %d %.6lf %.6lf %.6lf %.6lf %.8lf %.8lf %.8lf \n", sv[i].yr, sv[i].jd, sv[i].sec, sv[i].x, sv[i].y,
+		        sv[i].z, sv[i].vx, sv[i].vy, sv[i].vz);
+	}
+	return (1);
+}
+
+int pop_led_pre(tree *xml_tree, state_vector *sv, double t1, double t2) {
+	int i, count, num = 0;
+	char tmp_c[200], tmp_y[200];
+	double tmp_d, tmp_t;
+	state_vector tmp_sv;
+
+	search_tree(xml_tree, "/LT1_Orbit_File/Data_Block/List_of_OSVs/", tmp_c, 3, 0, 1);
+	count = (int)str2double(tmp_c);
+	// printf("Reading %d lines from precise orbit...(%s) \n",count,tmp_c);
+
+//search_tree(xml_tree, "/LT1_Orbit_File/Data_Block/List_of_OSVs/OSV/X/", tmp_c, 1, 4, 37497);
+//printf("%s\n",tmp_c);
+//exit(1);
+
+	for (i = 0; i < count; i++) {
+		search_tree(xml_tree, "/LT1_Orbit_File/Data_Block/List_of_OSVs/OSV/UTC/", tmp_c, 2, 4, i + 1);
+		tmp_d = str2double(tmp_c);
+		search_tree(xml_tree, "/LT1_Orbit_File/Data_Block/List_of_OSVs/OSV/UTC/", tmp_c, 1, 4, i + 1);
+		strasign(tmp_y, tmp_c, 0, 3);
+		tmp_sv.yr = (int)(str2double(tmp_y));
+		tmp_sv.jd = (int)(tmp_d - trunc(tmp_d / 1000.0) * 1000.0);
+		tmp_sv.sec = (tmp_d - trunc(tmp_d)) * 86400;
+		tmp_t = yds2ydf(tmp_sv);
+//printf("%lf %lf %lf \n",t1,tmp_t,t2);
+		if (tmp_t < t1 || tmp_t > t2) {
+			continue;
+		}
+		else {
+//printf("%d %d %.6f %s (%d)\n",tmp_sv.yr,tmp_sv.jd,tmp_sv.sec, tmp_c ,i);
+			sv[num].yr = tmp_sv.yr;
+			sv[num].jd = tmp_sv.jd;
+			sv[num].sec = tmp_sv.sec;
+			search_tree(xml_tree, "/LT1_Orbit_File/Data_Block/List_of_OSVs/OSV/X/", tmp_c, 1, 4, i + 1);
+			sv[num].x = str2double(tmp_c);
+			search_tree(xml_tree, "/LT1_Orbit_File/Data_Block/List_of_OSVs/OSV/Y/", tmp_c, 1, 4, i + 1);
+			sv[num].y = str2double(tmp_c);
+			search_tree(xml_tree, "/LT1_Orbit_File/Data_Block/List_of_OSVs/OSV/Z/", tmp_c, 1, 4, i + 1);
+			sv[num].z = str2double(tmp_c);
+			search_tree(xml_tree, "/LT1_Orbit_File/Data_Block/List_of_OSVs/OSV/VX/", tmp_c, 1, 4, i + 1);
+			sv[num].vx = str2double(tmp_c);
+			search_tree(xml_tree, "/LT1_Orbit_File/Data_Block/List_of_OSVs/OSV/VY/", tmp_c, 1, 4, i + 1);
+			sv[num].vy = str2double(tmp_c);
+			search_tree(xml_tree, "/LT1_Orbit_File/Data_Block/List_of_OSVs/OSV/VZ/", tmp_c, 1, 4, i + 1);
+			sv[num].vz = str2double(tmp_c);
+//search_tree(xml_tree, "/LT1_Orbit_File/Data_Block/List_of_OSVs/OSV/Y/", tmp_c, 1, 4, i + 1);
+//printf("%.6f %d %d %.6f %.6f %.6f %.6f %.6f %.6f %.6f\n",str2double(tmp_c), sv[num].yr,sv[num].jd,sv[num].sec,sv[num].x,sv[num].y,sv[num].z,sv[num].vx,sv[num].vy,sv[num].vz);
+//exit(1);
+			num++;
+		}
+ //       if (i == 10) exit(1);
+	}
+	return (num);
+}
+
+double yds2ydf(state_vector s) {
+	// convert year, day, sec to year, day, fraction of day
+	double t = 0;
+	t = t + (double)s.yr * 1000;
+	t = t + (double)s.jd;
+	t = t + (double)s.sec / 86400.;
+	return (t);
+}


=====================================
preproc/NSR_preproc/include deleted
=====================================
@@ -1 +0,0 @@
-../S1A_preproc/include
\ No newline at end of file


=====================================
preproc/NSR_preproc/lib deleted
=====================================
@@ -1 +0,0 @@
-../S1A_preproc/lib
\ No newline at end of file


=====================================
preproc/S1A_preproc/lib/xml.c
=====================================
@@ -19,7 +19,7 @@
 
 /* global variables needed for the xml library */
 int N = 0;
-int MAX_TREE_SIZE = 600000; // size of the tree in maximum
+int MAX_TREE_SIZE = 2000000; // size of the tree in maximum
 int MAX_CHAR_SIZE = 60000;  // size of char arrays in maximum
 char STR[4000][60000];
 
@@ -496,9 +496,13 @@ int str_date2JD(char *str_JD, char *str_date) {
 double str2double(char *str) {
 	int i, n, m;
 	double value = 0.0, value1 = 0.0, value2 = 0.0, sgn = 1.0;
-	char tmp1[100], tmp2[100], tmp[100], str_tmp[100];
+	char tmp1[100], tmp2[100], tmp[100], str_tmp[100], str_tmp2[100];
 
 	strasign(str_tmp, str, 0, strlen(str));
+    while (str_tmp[0] == ' ') {
+        strcpy(str_tmp2,str_tmp);
+        strasign(str_tmp, str_tmp2, 1, strlen(str));
+    }
 
 	// decide the sign
 	if (str_tmp[0] == '-' || str_tmp[0] == '+') {



View it on GitLab: https://salsa.debian.org/debian-gis-team/gmtsar/-/compare/b627ebbddc004531021f503cd58bf132aa9a98e4...07faa3feec61c5489d857693dda2ba92cfe4fbb9

-- 
This project does not include diff previews in email notifications.
View it on GitLab: https://salsa.debian.org/debian-gis-team/gmtsar/-/compare/b627ebbddc004531021f503cd58bf132aa9a98e4...07faa3feec61c5489d857693dda2ba92cfe4fbb9
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20240629/e50bb1c8/attachment-0001.htm>


More information about the Pkg-grass-devel mailing list