Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Routing Outlets in Boundary Conditions #827

Merged
merged 74 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
495f5a2
preprocessing for routing
biljanaorescanin Sep 26, 2023
562383d
update some scripts
Sep 26, 2023
a69c57d
improved run.sh
Oct 3, 2023
e29ab36
improved code to make all inputs are raw files
Oct 3, 2023
6979ee4
Merge branch 'develop' into feature/yujinz/Routing_outlets_inBCS
gmao-rreichle Oct 3, 2023
ebfef85
re-write all ncl code to f90 code.
Oct 6, 2023
6cdae0b
change mk_runofftbl.F90 to include the feature of moving outlets to o…
Oct 12, 2023
e84a25e
code fixed for mask_MAPL_2d
Oct 12, 2023
e56959a
cleaned up the code
Oct 13, 2023
b8c88e6
Merge remote-tracking branch 'origin/develop' into feature/yujinz/Rou…
Oct 13, 2023
07fa4ef
Merge remote-tracking branch 'origin/feature/yujinz/mk_runofftbl_inBC…
Oct 13, 2023
859e63b
change the mk_runofftbl.F90 to make the ocean resolution not hard coded.
Nov 3, 2023
cdd6fec
Merge remote-tracking branch 'origin/develop' into feature/yujinz/Rou…
Nov 3, 2023
ae80fdf
preprocess cleaned up, only the outlet locations in land are produced
Nov 4, 2023
ade7eae
readme.txt added
Nov 8, 2023
e55ed62
Merge branch 'develop' into feature/yujinz/Routing_outlets_inBCS
biljanaorescanin Nov 13, 2023
05fbd70
Updated readme.txt
gmao-rreichle Nov 14, 2023
f8bfb91
change run.sh to run.py; remove ncdioMod.f90 and rwncMod.f90; remove …
Nov 20, 2023
01acd34
change nf_ to nf90_
Nov 21, 2023
66b7add
use netcdf in the baselib of GEOS
Nov 22, 2023
330db41
Merge remote-tracking branch 'origin/feature/yujinz/Routing_outlets_i…
Nov 22, 2023
c4bdc7c
Merge remote-tracking branch 'origin/develop' into feature/yujinz/Rou…
Nov 22, 2023
e43375f
Merge branch 'develop' into feature/yujinz/Routing_outlets_inBCS
biljanaorescanin Nov 30, 2023
a77594f
mk_runofftbl can read more general resolution name
Dec 3, 2023
b9fd53e
Merge remote-tracking branch 'origin/feature/yujinz/Routing_outlets_i…
Dec 3, 2023
f4dfb5d
Merge branch 'develop' into feature/yujinz/Routing_outlets_inBCS
biljanaorescanin Dec 5, 2023
07fd402
input path changed to a public directory
Dec 5, 2023
26d4c94
using netcdf in Discover
Dec 6, 2023
41a8a36
mk_runofftbl.F90 now can read MOM5 resolutions as well.
Dec 6, 2023
53e7359
Merge branch 'develop' into feature/yujinz/Routing_outlets_inBCS
biljanaorescanin Dec 8, 2023
cf6a9d0
build routing bcs executable without installation
weiyuan-jiang Dec 11, 2023
e009390
run.py will not build code, only run exe now.
Dec 12, 2023
9fcc82b
add NOINSTALL option to routing bc executables
weiyuan-jiang Dec 13, 2023
440a97f
simplify running script in build directory
weiyuan-jiang Dec 13, 2023
7c10381
Readme.txt modified, and rename the run_routing.sh to run_routing_ras…
Dec 14, 2023
9108c73
cleanup of mk_runofftbl.F90:
gmao-rreichle Dec 16, 2023
882f93c
fixed "executable" permissions (./Raster/preproc/routing/*[f90,txt])
gmao-rreichle Dec 16, 2023
048ec24
minor edits (./Raster/preproc/routing/readme.txt)
gmao-rreichle Dec 16, 2023
d47592c
fixed indentation (./Raster/preproc/routing/*.f90)
gmao-rreichle Dec 16, 2023
21dcbd2
a couple of trivial changes (run_routing_raster.py, get_outlets_land.…
gmao-rreichle Dec 16, 2023
ba2577f
fixed typo/build error from earlier commit (mk_runofftbl.F90)
gmao-rreichle Dec 16, 2023
029fa1f
Add get_finalID_msk.f90 to let the program read raw input from Discov…
Jan 23, 2024
290e447
fix a bug in get_landocean_Greenland_real.f90
Jan 23, 2024
44d2d3b
avoiding request of lat_30s.txt and lon_30s.txt from inputs
Jan 23, 2024
2bb8167
Input data description was added to readme.txt.
Jan 23, 2024
1a6f663
Merge branch 'develop' into feature/yujinz/Routing_outlets_inBCS
biljanaorescanin Jan 24, 2024
671b8fd
removing the dependence on Pfafstetter.rst
Jan 24, 2024
3a203dc
Merge remote-tracking branch 'origin/develop' into feature/yujinz/Rou…
Feb 5, 2024
268ed1a
Merge branch 'develop' into feature/yujinz/Routing_outlets_inBCS
gmao-rreichle Mar 8, 2024
c62f4ae
Merge branch 'develop' into feature/yujinz/Routing_outlets_inBCS
gmao-rreichle Mar 24, 2024
2088626
minor cleanup and documentation (routing_constant.f90)
gmao-rreichle Mar 27, 2024
3ae8dfd
fixed indentation (get_finalID_msk.f90)
gmao-rreichle Mar 27, 2024
3869f51
Inputs are passed into the program via a command line argument
Apr 11, 2024
2f9964c
fix bug in run_routing_raster.py
Apr 11, 2024
dd53aa1
Adding comments to mk_runofftbl.F90
Apr 18, 2024
07856b5
moving input description to input directory and adding NAS path for i…
Apr 26, 2024
3f6e2a8
Merge branch 'develop' into feature/yujinz/Routing_outlets_inBCS
gmao-rreichle May 4, 2024
7380ec3
Merge branch 'develop' into feature/yujinz/Routing_outlets_inBCS
gmao-rreichle May 10, 2024
7dfb381
Adding note (suggested by Randy Koster) to the code under preproc/rou…
May 21, 2024
cc738ca
re-write get_domain_name() in the mk_runofftbl.F90
Jun 16, 2024
6076b83
Merge remote-tracking branch 'origin/feature/yujinz/Routing_outlets_i…
Jun 16, 2024
32822f3
fix a bug (missing fileT definition) in the get_domain_name() of the …
Jun 17, 2024
cbd311d
changed example grid to "M6TP0072x0036" and rename var file to Gridname
Jun 17, 2024
b71f106
fix a small bug
Jun 17, 2024
d17d852
documentation added in mk_runofftble.f90
Jun 17, 2024
349249f
edited documentation and comments in mk_runofftbl.F90
gmao-rreichle Jun 18, 2024
76b9bee
Merge branch 'develop' into feature/yujinz/Routing_outlets_inBCS
gmao-rreichle Jun 18, 2024
0d8b396
cleaned up specification of path to bcs_shared directory (run_routing…
gmao-rreichle Jun 18, 2024
d614312
nx_MAPL=-9999 and ny_MAPL=-9999
Jun 18, 2024
6b1395d
version information added in mk_runofftble.f90
Jun 21, 2024
ecda649
Add documentation for version information in mk_runofftbl.f90 and add…
Jun 21, 2024
303b84f
outlet version definition was moved to rmTinyCatchParaMod.F90
Jul 2, 2024
a54f139
fixed bugs, now the correct version information can be read in mk_run…
Jul 3, 2024
4be7ffe
cleaned up and improved documentation of outlet locations version (mk…
gmao-rreichle Jul 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
program main

use omp_lib
use rwncfile
implicit none

character(len=100) :: var1="outlet_sinky_allcat"
character(len=100) :: var2="outlet_sinkx_allcat"
character(len=100) :: map="Pfafstetter_Greenland_real.nc"
integer,parameter :: nc=291809
integer,parameter :: nlon=43200
integer,parameter :: nlat=21600
gmao-rreichle marked this conversation as resolved.
Show resolved Hide resolved

real*8,allocatable :: lon(:),lat(:)
integer,allocatable :: catchind(:,:)
integer,allocatable :: data2d(:,:)
integer,allocatable :: data_Pfaf(:)

integer :: xi,yi,id


allocate(catchind(nlon,nlat),data2d(nlon,nlat))
allocate(lon(nlon),lat(nlat))
call read_ncfile_double1d("outputs/"//trim(map),"lon",lon,nlon)
call read_ncfile_double1d("outputs/"//trim(map),"lat",lat,nlat)
call read_ncfile_int2d("outputs/"//trim(map),"data",catchind,nlon,nlat)

allocate(data_Pfaf(nc))

open(77,file="outputs/"//trim(var1)//".txt")
read(77,*)data_Pfaf
data2d=-999
do xi=1,nlon
do yi=1,nlat
if(catchind(xi,yi)>=1.and.catchind(xi,yi)<=nc)then
id=catchind(xi,yi)
data2d(xi,yi)=data_Pfaf(id)
endif
enddo
enddo
call create_ncfile_int2d_fill("outputs/"//trim(var1)//"_2d.nc","data",data2d,lon,lat,nlon,nlat,-999.)

open(77,file="outputs/"//trim(var2)//".txt")
read(77,*)data_Pfaf
data2d=-999
do xi=1,nlon
do yi=1,nlat
if(catchind(xi,yi)>=1.and.catchind(xi,yi)<=nc)then
id=catchind(xi,yi)
data2d(xi,yi)=data_Pfaf(id)
endif
enddo
enddo
call create_ncfile_int2d_fill("outputs/"//trim(var2)//"_2d.nc","data",data2d,lon,lat,nlon,nlat,-999.)




end
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

if [ $# -lt 1 ]; then
echo "no f90 specified"
exit
fi

string=$1
array=(${string//./ })

FILENAME=${array[0]}


NETCDF_PATH=/discover/nobackup/yzeng3/apps/netcdf-4.2.1.1

ifort -qopenmp ncdioMod.f90 rwncMod.f90 ${FILENAME}.f90 -I$NETCDF_PATH/include -L$NETCDF_PATH/lib -L/usr/local/intel/oneapi/2021/compiler/2021.4.0/linux/lib -lnetcdf -lnetcdff -o ${FILENAME}.out



Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
program main

use omp_lib
use rwncfile
implicit none

integer,parameter :: nc=291809
integer,parameter :: nlon=43200
integer,parameter :: nlat=21600
integer,parameter :: nlon_G=8400
integer,parameter :: nlat_G=4800
integer,parameter :: loni_min=12001
integer,parameter :: loni_max=20400
integer,parameter :: lati_min=16801
integer,parameter :: lati_max=21600

integer,parameter :: id_glac=290191
integer,parameter :: id_lake=290190
integer,parameter :: id_landend=290188

real*8,allocatable,dimension(:) :: lon,lat,lon_G,lat_G
integer,allocatable,dimension(:,:) :: landocean,Greenland
integer,allocatable,dimension(:) :: Pfaf_real, countc

integer :: i,j

allocate(landocean(nlon,nlat))
allocate(lon(nlon),lat(nlat))
call read_ncfile_double1d("inputs/Pfafstetter.nc","lon",lon,nlon)
call read_ncfile_double1d("inputs/Pfafstetter.nc","lat",lat,nlat)
call read_ncfile_int2d("inputs/Pfafstetter.nc","data",landocean,nlon,nlat)

allocate(Greenland(nlon_G,nlat_G))
allocate(lon_G(nlon_G),lat_G(nlat_G))
call read_ncfile_double1d("inputs/GreenlandID_30s.nc","lon",lon_G,nlon_G)
call read_ncfile_double1d("inputs/GreenlandID_30s.nc","lat",lat_G,nlat_G)
call read_ncfile_int2d("inputs/GreenlandID_30s.nc","data",Greenland,nlon_G,nlat_G)

where(Greenland/=-9999.and.(landocean(loni_min:loni_max,lati_min:lati_max)<=id_landend.or.&
landocean(loni_min:loni_max,lati_min:lati_max)==id_glac ))&
landocean(loni_min:loni_max,lati_min:lati_max)=Greenland


where(landocean>id_landend.and.landocean<id_lake) landocean=-9999
where(landocean==id_lake.or.landocean==id_glac) landocean=0

allocate(Pfaf_real(id_landend))
open(77,file="inputs/Pfaf_real.txt")
read(77,*)Pfaf_real

do i=1,nlon
do j=1,nlat
if(landocean(i,j)<=id_landend.and.landocean(i,j)>=1)then
landocean(i,j)=Pfaf_real(landocean(i,j))
else if(landocean(i,j)>=700000000)then
landocean(i,j)=landocean(i,j)-700000000+291284
endif
enddo
enddo



call create_ncfile_int2d("outputs/Pfafstetter_Greenland_real.nc","data",landocean,lon,lat,nlon,nlat)


end
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
program main

implicit none

integer,parameter :: nc=291284
integer,parameter :: ns=22612
integer,parameter :: ng=525

integer,allocatable,dimension(:) :: msk,outid,mskall,final,finalall

integer :: k,i,ntot

ntot=nc+ng
allocate(msk(nc),outid(ns),mskall(ntot),final(nc),finalall(ntot))
open(77,file="inputs/Pfaf_msk.txt")
read(77,*)msk
k=0
do i=1,nc
if(msk(i).eq.2)then
k=k+1
outid(k)=i
end if
end do
do i=k+1,ns
outid(i)=nc+i-k
end do
open(88,file="outputs/outlet_catchindex.txt")
do i=1,ns
write(88,*)outid(i)
enddo

mskall(1:nc)=msk
mskall(nc+1:)=2
open(88,file="outputs/Pfaf_msk_all.txt")
do i=1,ntot
write(88,*)mskall(i)
enddo

open(77,file="inputs/Pfaf_finalID.txt")
read(77,*)final
finalall(1:nc)=final
do i=nc+1,ntot
finalall(i)=i
end do
open(88,file="outputs/Pfaf_finalID_all.txt")
do i=1,ntot
write(88,*)finalall(i)
enddo



end
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
program main

use omp_lib
use rwncfile
implicit none

integer,parameter :: nc=291284
integer,parameter :: nl=22087
integer,parameter :: ng=525
integer,parameter :: nlon=21600
integer,parameter :: nlat=10800

real*8,allocatable :: lon(:),lat(:),long(:),latg(:),lons(:),lats(:)
integer,allocatable :: catchind(:,:)
real,allocatable :: acah(:,:)
integer,allocatable :: down(:),sx(:),sy(:),msk(:)
real,allocatable :: acas(:)

integer :: id,xi,yi,i,k,xis,yis,ntot

ntot=nl+ng
allocate(catchind(nlon,nlat),acah(nlon,nlat))
allocate(lon(nlon),lat(nlat))
allocate(sx(nc),sy(nc),acas(nc),down(nc),msk(nc))
allocate(long(ng),latg(ng),lons(ntot),lats(ntot))

call read_ncfile_double1d("inputs/CatchIndex.nc","lon",lon,nlon)
call read_ncfile_double1d("inputs/CatchIndex.nc","lat",lat,nlat)
call read_ncfile_int2d("inputs/CatchIndex.nc","data",catchind,nlon,nlat)
call read_ncfile_real2d("inputs/HydroSHEDS_drainage_area.nc","data",acah,nlon,nlat)


open(77,file="inputs/downstream_1D_new_noadj.txt")
read(77,*)down
open(77,file="inputs/Pfaf_msk.txt")
read(77,*)msk

acas=-9999.
sx=0
sy=0
do xi=1,nlon
do yi=1,nlat
if(catchind(xi,yi)>=1)then
id=catchind(xi,yi)
if(down(id)==-1.and.acah(xi,yi)>=acas(id))then
acas(id)=acah(xi,yi)
sx(id)=xi
sy(id)=yi
endif
endif
enddo
enddo

where(down/=-1)sx=-1
where(down/=-1)sy=-1
k=0
do i=1,nc
if(msk(i)==2)then
k=k+1
lons(k)=lon(sx(i))
lats(k)=lat(sy(i))
endif
enddo
!print *,k

open(77,file="inputs/Greenland_outlets_lat.txt")
read(77,*)latg
open(77,file="inputs/Greenland_outlets_lon.txt")
read(77,*)long

lons(k+1:ntot)=long
lats(k+1:ntot)=latg


open(88,file="outputs/outlet_sinklat.txt")
do i=1,ntot
write(88,*)lats(i)
enddo
open(88,file="outputs/outlet_sinklon.txt")
do i=1,ntot
write(88,*)lons(i)
enddo




end
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
program main

use omp_lib

implicit none

integer,parameter :: nall=291809
integer,parameter :: nc=22612

integer, allocatable, dimension(:) :: id_final,id_outlet,msk
integer,allocatable,dimension(:) :: lati_outlet,loni_outlet
integer,allocatable,dimension(:) :: lati_full,loni_full

integer :: i,j

allocate(id_final(nall),id_outlet(nc),msk(nall),&
lati_outlet(nc),loni_outlet(nc),lati_full(nall),loni_full(nall))

open(77,file="outputs/Pfaf_finalID_all.txt")
read(77,*)id_final
open(77,file="outputs/outlet_catchindex.txt")
read(77,*)id_outlet
open(77,file="outputs/outlet_sinky.txt")
read(77,*)lati_outlet
open(77,file="outputs/outlet_sinkx.txt")
read(77,*)loni_outlet
open(77,file="outputs/Pfaf_msk_all.txt")
read(77,*)msk

lati_full=-999
loni_full=-999

do i=1,nall
!if(mod(i,1000)==0) print *,i
if(msk(id_final(i)).eq.2)then
do j=1,nc
if(id_outlet(j).eq.id_final(i))then
lati_full(i)=lati_outlet(j)
loni_full(i)=loni_outlet(j)
end if
enddo
else if(msk(id_final(i)).eq.3)then
lati_full(i)=-999
loni_full(i)=-999
endif
end do

open(88,file="outputs/outlet_sinky_allcat.txt")
do i=1,nall
write(88,*)lati_full(i)
enddo
open(88,file="outputs/outlet_sinkx_allcat.txt")
do i=1,nall
write(88,*)loni_full(i)
enddo



end
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
program main

use rwncfile
implicit none

integer,parameter :: ns=22612
integer,parameter :: nlat=21600
integer,parameter :: nlon=43200

real*8,allocatable,dimension(:) :: lats,lons,lat30s,lon30s,lat_dis,lon_dis
integer,allocatable,dimension(:) :: lati,loni

integer :: i,temp(1)

allocate(lats(ns),lons(ns),lati(ns),loni(ns))
allocate(lat30s(nlat),lon30s(nlon),lat_dis(nlat),lon_dis(nlon))
open(77,file="outputs/outlet_sinklat.txt")
read(77,*)lats
open(77,file="outputs/outlet_sinklon.txt")
read(77,*)lons
open(77,file="inputs/lat_30s.txt")
read(77,*)lat30s
open(77,file="inputs/lon_30s.txt")
read(77,*)lon30s

do i=1,ns
lat_dis=abs(lat30s-lats(i))
temp=minloc(lat_dis)
lati(i)=temp(1)
enddo
do i=1,ns
lon_dis=abs(lon30s-lons(i))
temp=minloc(lon_dis)
loni(i)=temp(1)
enddo

open(88,file="outputs/outlet_sinky.txt")
do i=1,ns
write(88,*)lati(i)
enddo
open(88,file="outputs/outlet_sinkx.txt")
do i=1,ns
write(88,*)loni(i)
enddo

end
Loading