Skip to content

Commit

Permalink
udated output format
Browse files Browse the repository at this point in the history
  • Loading branch information
MenakaRevel committed Dec 5, 2022
1 parent 4914c60 commit 289eb19
Show file tree
Hide file tree
Showing 69 changed files with 93 additions and 57 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#
# from read_patchMS import upstream
#==============================
CaMa_dir = "/cluster/data6/menaka/CaMa-Flood_v396a_20200514"
CaMa_dir = "/cluster/data6/menaka/CaMa-Flood_v4"
mapname= "glb_06min"
#==============================
#=================================
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion img_code/mk_fig_mool.sh → ESSD_paper/mk_fig_mool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export OMP_NUM_THREADS=$NCPUS

# got to working dirctory
# cd $PBS_O_WORKDIR
cd "/cluster/data6/menaka/AltiMaP/img_code"
cd "/cluster/data6/menaka/AltiMaP/ESSD_paper"


mkdir -p fig
Expand Down
File renamed without changes.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
### Dataset Varaibles
# VS metadata
ID: Identification number of VS
station :VS name
dataname :dataset name
lon :longitude [degrees east]
lat :latitude [degrees north]
satellite :name of the satellite
# MERIT Hydro-related
flag :allocation flag
elevation :elevation at VS location on MERIT Hydro [m]
dist_to_mouth :distance to the unit-catchment mouth [km]
kx1 :best x-coordinate with respect to the 10°×10° higher resolution tile
ky1 :best y-coordinate with respect to the 10°×10° higher resolution tile
kx2 :second-best option of x-coordinate with respect to the 10°×10° high-resolution tile
ky2 :second-best option of y-coordinate with respect to the 10°×10° high-resolution tile
dist1 :distance from the second-best location to the VS [km]
dist2 :distance from the second-best location to the VS [km]
rivwth :River width of the allocated location [m]
# Coarse-resolution river network-related
ix :x-coordinate with respect to coarse resolution
iy :y-coordinate with respect to coarse resolution
EGM08 :EGM 2008 datum elevation[m]
EGM96 :EGM 1996 datum elevation[m]


### Altimetry Virtual Stations on CaMa-Flood River Network

1. Allocate virtual stations to the CaMa-Flood map
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 5 additions & 4 deletions s01-allocate_VS.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#! /bin/bash

### SET "mool PBS" @ IIS U-Tokyo
#PBS -q F40
#PBS -q E40
#PBS -l select=1:ncpus=40:mem=100gb
#PBS -l place=scatter
#PBS -j oe
Expand All @@ -17,7 +17,7 @@ export OMP_NUM_THREADS=$NCPUS

# got to working dirctory
# cd $PBS_O_WORKDIR
cd "/cluster/data6/menaka/Altimetry"
cd "/cluster/data6/menaka/AltiMaP"

#CaMA-Flood directory
# CaMa_dir="/cluster/data6/menaka/CaMa-Flood_v396a_20200514"
Expand Down Expand Up @@ -50,11 +50,12 @@ fi

echo "starting calculations........"
# echo " ID station dataname lon lat ix iy ele_diff EGM08 EGM96 satellite" > tmp.txt
printf '%30s%67s%12s%10s%10s%8s%12s%10s%17s%6s%15s%12s%10s%8s%8s%8s%12s%12s%10s%8s%12s%10s\n' ID station dataname lon lat ix iy elevation EGM08 EGM96 flag satellite dist_to_mouth kx1 ky1 kx2 ky2 dist1 dist2 rivwth > tmp.txt
# printf '%30s%67s%12s%10s%10s%8s%12s%10s%17s%6s%15s%12s%10s%8s%8s%8s%12s%12s%10s%8s%12s%10s\n' ID station dataname lon lat ix iy elevation EGM08 EGM96 flag satellite dist_to_mouth kx1 ky1 kx2 ky2 dist1 dist2 rivwth > tmp.txt
printf '%13s%64s%12s%12s%10s%17s%6s%12s%15s%10s%8s%8s%8s%14s%12s%12s%10s%8s%12s%10s\n' ID station dataname lon lat satellite flag elevation dist_to_mouth kx1 ky1 kx2 ky2 dist1 dist2 rivwth ix iy EGM08 EGM96 > tmp.txt
SOUTH=-60
while [ $SOUTH -lt 90 ];
do
WEST=-180
WEST=-80 #-180
while [ $WEST -lt 180 ];
do
CNAME=`./src/set_name $WEST $SOUTH`
Expand Down
11 changes: 8 additions & 3 deletions s03-unreal_obs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export OMP_NUM_THREADS=$NCPUS

# got to working dirctory
# cd $PBS_O_WORKDIR
cd "/cluster/data6/menaka/Altimetry"
cd "/cluster/data6/menaka/AltiMaP"

#CaMA-Flood directory
# CaMa_dir="/cluster/data6/menaka/CaMa-Flood_v396a_20200514"
Expand All @@ -42,12 +42,14 @@ map="glb_06min"
dataname="HydroWeb"

# observation list
obstxt="/cluster/data6/menaka/Altimetry/out/altimetry_"$map"_20220725.txt"
obstxt="/cluster/data6/menaka/AltiMaP/out/altimetry_"$map"_20221205.txt"

# out dir
outdir="./out"
mkdir -p $outdir

outname="biased_removed_altimetry_"$map"_"${day}".txt"

# threshold for finding outliers
threshold=10.0 #m

Expand All @@ -57,7 +59,10 @@ threshold=10.0 #m
# mkdir -p $figdir
day=$(date +"%Y%m%d")

python src/unreal_obs.py $dataname $map $CaMa_dir $TAG $obstxt $threshold > "$outdir/unreal_obs_${day}.txt" #& #> /dev/null 2>&1 &
printf '%13s%64s%12s%12s%10s%17s%6s%12s%15s%10s%8s%8s%8s%14s%12s%12s%10s%8s%12s%10s\n' ID station dataname lon lat satellite flag elevation dist_to_mouth kx1 ky1 kx2 ky2 dist1 dist2 rivwth ix iy EGM08 EGM96 > tmp.txt
python src/unreal_obs.py $dataname $map $CaMa_dir $TAG $obstxt $threshold >> tmp.txt #& #> /dev/null 2>&1 &

mv tmp.txt "$outdir/$outname"

wait

Expand Down
13 changes: 8 additions & 5 deletions src/allocate_VS.f90
Original file line number Diff line number Diff line change
Expand Up @@ -526,11 +526,14 @@ program SET_MAP
! print*, trim(station), lon0, lat0, ix, iy, flag, dist1, dist2
! print*, "================================================"
if (iXX > 0 .or. iYY > 0) then
print '(a30,2x,a65,2x,a10,2x,2f10.2,2x,2i8.0,2x,3f10.2,2x,a15,2x,f13.2,2x,i4.0,2x,4i8.0,2f12.2,2x,f13.2)',&
&trim(adjustl(id)), trim(station), trim(dataname), lon0, lat0, iXX, iYY, ele1m(kx,ky),&
&egm08, egm96, trim(sat), diffdist*1e-3, flag, kx1, ky1, kx2, ky2, dist1, dist2, riv1m(kx,ky) ! elevtn(iXX,iYY)-
! else
! print*, "no data"
! print '(a30,2x,a65,2x,a10,2x,2f10.2,2x,2i8.0,2x,3f10.2,2x,a15,2x,f13.2,2x,i4.0,2x,4i8.0,2f12.2,2x,f13.2)',&
! &trim(adjustl(id)), trim(station), trim(dataname), lon0, lat0, iXX, iYY, ele1m(kx,ky),&
! &egm08, egm96, trim(sat), diffdist*1e-3, flag, kx1, ky1, kx2, ky2, dist1, dist2, riv1m(kx,ky) ! elevtn(iXX,iYY)-

print '(a13,4x,a60,2x,a10,2x,2f10.2,2x,a15,2x,i4.0,2x,f10.2,2x,f13.2,2x,4i8.0,2x,3f12.2,2x,2i8.0,2x,2f10.2)',&
&trim(adjustl(id)), trim(station), trim(dataname), lon0, lat0, trim(sat),&
&flag, ele1m(kx,ky),diffdist*1e-3, kx1, ky1, kx2, ky2, dist1, dist2, riv1m(kx,ky),&
&iXX, iYY, egm08, egm96
end if
! write(27,'(a14,2x,a40,2x,a10,2x,2f10.2,2x,2i8.0,2x,3f10.2,2x,a15)') trim(adjustl(id)),&
! &trim(station),trim(dataname), lon0, lat0,iXX, iYY,elevtn(iXX,iYY)-ele1m(kx,ky),&
Expand Down
87 changes: 44 additions & 43 deletions src/unreal_obs.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/opt/local/bin/python
# -*- coding: utf-8 -*-

'''
Located biased VS
'''
import datetime
import numpy as np
from numpy import ma
Expand Down Expand Up @@ -251,50 +253,49 @@ def meanHydroWeb(station,egm08=0.0,egm96=0.0):
line2 = re.split("_",station)
riv = line2[1]
stream = line2[2]
dataname= line[2]
lon = float(line[3])
lat = float(line[4])
ix = int(line[5])-1
iy = int(line[6])-1
sat = line[5]
#--
flag = int(line[6])
elev = float(line[7])
EGM08 = float(line[8])
EGM96 = float(line[9])
sat = line[10].strip()
dist = float(line[11])
flag = int(line[12])
kx = int(line[13])
ky = int(line[14])
# rivwth = float(line[19])
#-----------------------
# print (riv,station,kx,ky)
# if riv != rivername0:
# continue
# if stream != stream0:
# continue
nums.append(num)
river.append(riv)
pname.append(station)
lons.append(lon)
lats.append(lat)
xlist.append(ix)
ylist.append(iy)
lelev.append(elev)
egm08.append(EGM08)
egm96.append(EGM96)
llsat.append(sat)
ldtom.append(dist)
lflag.append(flag)
kxlst.append(kx)
kylst.append(ky)
# print (riv,station)
#=============================
pnum=len(pname)
#=====================================
for point in np.arange(pnum):
meanW, stdW = meanHydroWeb(pname[point],egm96=egm96[point],egm08=egm08[point])
iXX = xlist[point]
iYY = ylist[point]
elev= lelev[point]
sat = llsat[point]
dist = float(line[8])
kx1 = int(line[9])
ky1 = int(line[10])
kx2 = int(line[11])
ky2 = int(line[12])
dist1 = float(line[13])
dist2 = float(line[14])
rivwth = float(line[15])
#--
ix = int(line[16])
iy = int(line[17])
EGM08 = float(line[18])
EGM96 = float(line[19])

# nums.append(num)
# river.append(riv)
# pname.append(station)
# lons.append(lon)
# lats.append(lat)
# xlist.append(ix)
# ylist.append(iy)
# lelev.append(elev)
# egm08.append(EGM08)
# egm96.append(EGM96)
# llsat.append(sat)
# ldtom.append(dist)
# lflag.append(flag)
# kxlst.append(kx)
# kylst.append(ky)
meanW, stdW = meanHydroWeb(station,egm96=EGM96,egm08=EGM08)
# iXX = xlist[point]
# iYY = ylist[point]
# elev= lelev[point]
# sat = llsat[point]
# if meanW > elevtn[iYY,iXX] + upthr or meanW < elevtn[iYY,iXX] - dwthr:
if meanW > elev + upthr or meanW < elev - dwthr:
print ("%69s%4d%12.3f%12.3f%12.3f%15s%12.3f")%(pname[point],lflag[point],elev,meanW,meanWSE_VICBC[iYY+dYY,iXX+dXX],sat,meanW - elev)
flag=flag+100
# print ("%69s%4d%12.3f%12.3f%12.3f%15s%12.3f")%(pname[point],lflag[point],elev,meanW,meanWSE_VICBC[iYY+dYY,iXX+dXX],sat,meanW - elev)
print ("%13s%64s%12s%12.2f%12.2f%17s%6d%12.2f%15.2f%10d%8d%8d%8d%14.2f%12.2f%12.2f%10d%8d%12.2f%10.2f")%(num,station,dataname,lon,lat,sat,flag,elev,dist,kx1,ky1,kx2,ky2,dist1,dist2,rivwth,ix,iy,EGM08,EGM96)

0 comments on commit 289eb19

Please # to comment.