XYZ - GRD

 

 

 #!/bin/csh

#USGS-DEM donusturme xyz->grd
xyz2grd SRTM3/N40E026.hgt -Ggelibolu.grd -I3c -R26/27/40/41 -N-32768 -V -ZTLhw

## yuzey gradyaninin olusturulmasi (-A isiklandirma icin azimut degeri, 0: kuzey, 90:dogu ...)
grdgradient gelibolu.grd -A0 -Ggelibolu_grad.grd -Nt

#topografya cizimi
grdimage -R26/27/40/41 gelibolu.grd -Igelibolu_grad.grd -JM5 -Catlas.cpt -X1.8 -Y4 -K -P > xyz-grd.ps
pscoast -R -JM -O -K -Df -S255 -W2 -B0.2f0.1g0.1/0.1g0.1 >> xyz-grd.ps

#Profil cizgisi
psxy -R -JM -O -K -W10 -: <<END>> xyz-grd.ps
40.8 26.7
40.55 26.9
END
# A-B harfleri
pstext -R -JM -O -K -: -C0.01/0.01 -W255 <<END>> xyz-grd.ps
40.8 26.7 10 0 1 CM A
40.55 26.9 10 0 1 CM B
END



# Bir profil uzerinden topografya kesiti alma:
gmtset D_FORMAT %lg
# -C: baslangic -E: son -G: ornekleme araligi -Q: uzaklik birimini km kabul eder
# cikis dosyasi : boylam-enlem-uzaklik(km) [-G: her bir 0.001km (1m) de ornek alinir ]
project -C26.7/40.8 -E26.9/40.55 -G0.001 -Q > gelibolu_profil.xyz

#grd dosyasindan profil boyunca degerleri secmek:
# cikis dosyasi: boylam-enlem-uzaklik-yukseklik
grdtrack gelibolu_profil.xyz -Ggelibolu.grd -R > gelibolu_kesit.xz

# kesitin cizimi
awk '{print $3,$4}' gelibolu_kesit.xz | psxy -JX13c/6c -R0/40/0/400 -W4 -P -B5f1:"X (km)":/100f50:"h (m)":WSen -Y-3 -K -O >> xyz-grd.ps

# A-B harfleri
pstext -R -JX -O -K -C0.03/0.03 -W0 -G255 <<END>> xyz-grd.ps
2 375 10 0 1 CM A
32 375 10 0 1 CM B
END



###########

## XYZ <-> GRD arasinda donusum
grd2xyz gelibolu.grd -R26.1/26.2/40.0/40.1 > abide.xyz
xyz2grd abide.xyz -Gabide.grd -I3c -R26.1/26.2/40.0/40.1 > abide.grd # esit orneklemeli ASCII veri icin
# surface abide.xyz -Gabide.grd -I3c -R26.1/26.2/40.0/40.1 > abide.xyz2 # rasgele orneklemeli ASCII veri icin
# diger komutlar: nearneighbor,triangulate

grdgradient abide.grd -A0 -Gabide_grad.grd -Nt
grdimage -R26.15/26.2/40.03/40.1 abide.grd -Iabide_grad.grd -JM1 -Cem.cpt -X-1.2 -Y3.5 -O -K -P >> xyz-grd.ps 
pscoast -R -JM -O -Df -S255 -B0 -W2 >> xyz-grd.ps



rm .gmtdefaults