Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
croco_tools
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
croco-ocean
croco_tools
Commits
d8d427ee
Commit
d8d427ee
authored
1 year ago
by
Gildas Cambon
Browse files
Options
Downloads
Patches
Plain Diff
RIVERS : bug fixes + cosmetics
- bug fixes in the runoff positionning - cleaning and cosmetics
parent
54d83443
No related branches found
No related tags found
No related merge requests found
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Rivers/locate_runoff.m
+130
-49
130 additions, 49 deletions
Rivers/locate_runoff.m
Rivers/make_runoff.m
+148
-179
148 additions, 179 deletions
Rivers/make_runoff.m
Rivers/runoff_glob_extract.m
+10
-7
10 additions, 7 deletions
Rivers/runoff_glob_extract.m
with
288 additions
and
235 deletions
Rivers/locate_runoff.m
+
130
−
49
View file @
d8d427ee
function
[
j2
,
i2
]
=
locate_runoff
(
dir
,
j
,
i
,
mask
,
masku
,
maskv
)
%
function
[
j2for_out
,
i2for_out
,
j2for
,
i2for
,
j2
,
i2
]
=
locate_runoff
(
dir
,
j
,
i
,
mask
,
masku
,
maskv
)
%=======================================================================================================
% input :
% j,i : first guess river position
% dir : direction and sense of the flow
%
% output :
% j2,i2 : index position (eta, xi) at rho-point for runoff, in matlab convention
% in MATLAB, rho, u and v indexing start at 1 !
%
% MATLAB
% |-------- v(i,j) -------|
% | |
% | |
% u(i-1,j) r(i,j) u(i,j)
% | |
% | |
% |-------- v(i,j-1) -----|
%
% j2for, i2for : index position (eta, xi) at rho-point for runoff, in CROCO convention
% in CROCO fortran, rho start at 0, u and v indexing start at 1 !,
%
% zero index is a ghost cell, with no staggerd u-point on right and v point below
%
%
% CROCO fortran
% |-------- v(i,j+1) -----|
% | |
% | |
% u(i,j) r(i,j) u(i+1,j)
% | |
% | |
% |-------- v(i,j) -------|
%
% j2for_out, i2for_out : index for runoff positions, at u and v cells, in CROCO fortran index convention.
% i- and j- are of the u or v cells that are flowing into the target wet cell
%
% It is computed depending :
% - the runoff direction (zonal=0, meridian=1)
% - the sense (east-west/south-north =1 ; west-east/north-south =-1
% - the landmask around ...
%
%=======================================================================================================
if
mask
(
j
,
i
)
==
1
disp
(
'River positionned in sea'
)
insea
=
1
;
...
...
@@ -12,76 +50,119 @@ else
end
if
dir
(
1
)
==
0
if
insea
if
dir
(
2
)
==-
1
%est - west => TESTED
while
masku
(
j
,
i
)
==
1
i
=
i
+
1
;
%disp(['MASKU:',num2str(masku(j,i))])
end
%disp(['--'])
%disp(['MASKU:',num2str(masku(j,i))])
elseif
dir
(
2
)
==
1
% west - est => TESTED
while
masku
(
j
,
i
)
==
1
if
dir
(
2
)
==
1
% >> : west - east => TESTED
while
mask
(
j
,
i
)
==
1
i
=
i
-
1
;
%disp(['MASKU:',num2str(masku(j,i))])
disp
([
'MASK:'
,
num2str
(
mask
(
j
,
i
))])
end
disp
([
'--'
])
disp
([
'MASK:'
,
num2str
(
mask
(
j
,
i
))])
disp
([
'MASKU:'
,
num2str
(
masku
(
j
,
i
))])
elseif
dir
(
2
)
==-
1
% << : east - west => TESTED
while
mask
(
j
,
i
)
==
1
i
=
i
+
1
;
disp
([
'MASK:'
,
num2str
(
mask
(
j
,
i
))])
end
%disp(['--'])
%disp(['MASKU:',num2str(masku(j,i))])
%in this case add +1 in i to get back into last wet cell
j
=
j
+
1
;
disp
([
'--'
])
disp
([
'MASK:'
,
num2str
(
mask
(
j
,
i
))])
disp
([
'MASKU:'
,
num2str
(
masku
(
j
,
i
))])
end
else
%inland
if
dir
(
2
)
==
1
%
west-est => TESTED
while
mask
u
(
j
,
i
)
~=
1
if
dir
(
2
)
==
1
% >> :
west-est => TESTED
while
mask
(
j
,
i
)
~=
1
i
=
i
+
1
;
%
disp(['MASK
U
:',num2str(mask
u
(j,i))])
disp
([
'MASK:'
,
num2str
(
mask
(
j
,
i
))])
end
disp
([
'--'
])
i
=
i
-
1
%
disp(['MASK:',num2str(masku(j,i))])
elseif
dir
(
2
)
==-
1
%e
st-west => TESTED
while
mask
u
(
j
,
i
)
~=
1
disp
([
'MASK:'
,
num2str
(
mask
(
j
,
i
))])
disp
([
'MASK
U
:'
,
num2str
(
masku
(
j
,
i
))])
elseif
dir
(
2
)
==
-
1
% << : ea
st-west => TESTED
while
mask
(
j
,
i
)
~=
1
i
=
i
-
1
;
%
disp(['MASK
U
:',num2str(mask
u
(j,i))])
disp
([
'MASK:'
,
num2str
(
mask
(
j
,
i
))])
end
%
disp(['--'])
i
=
i
+
1
;
%
disp(['MASKU:',num2str(masku(j,i))])
disp
([
'--'
])
disp
([
'MASK:'
,
num2str
(
mask
(
j
,
i
))])
disp
([
'MASKU:'
,
num2str
(
masku
(
j
,
i
))])
end
end
else
%dir(k,1)=1
if
insea
if
dir
(
2
)
==-
1
% nord - sud => TESTED
while
maskv
(
j
,
i
)
==
1
j
=
j
+
1
;
%disp(['MASKV:',num2str(maskv(j,i))])
end
%disp(['--'])
%disp(['MASKV:',num2str(maskv(j,i))])
elseif
dir
(
2
)
==
1
% sud - nord => TESTED
while
maskv
(
j
,
i
)
==
1
if
dir
(
2
)
==
1
% ^ : sud - nord => TESTED
while
mask
(
j
,
i
)
==
1
j
=
j
-
1
;
%
disp(['MASK
V
:',num2str(mask
v
(j,i))])
disp
([
'MASK:'
,
num2str
(
mask
(
j
,
i
))])
end
%disp(['--'])
%disp(['MASKV:',num2str(maskv(j,i))])
%in this case add +1 in j to get back into last wet cell
j
=
j
+
1
;
%
disp
([
'-- ^^ start insea'
])
disp
([
'MASK:'
,
num2str
(
mask
(
j
,
i
))])
disp
([
'MASKV:'
,
num2str
(
maskv
(
j
,
i
))])
elseif
dir
(
2
)
==
-
1
% v : nord - sud => TESTED
while
mask
(
j
,
i
)
==
1
j
=
j
+
1
;
disp
([
'MASK:'
,
num2str
(
mask
(
j
,
i
))])
end
disp
([
'--'
])
disp
([
'MASK:'
,
num2str
(
mask
(
j
,
i
))])
disp
([
'MASKV:'
,
num2str
(
maskv
(
j
,
i
))])
end
else
%inland
if
dir
(
2
)
==
1
%sud-nord => TESTED
while
mask
v
(
j
,
i
)
~=
1
if
dir
(
2
)
==
1
%
^:
sud-nord => TESTED
while
mask
(
j
,
i
)
~=
1
j
=
j
+
1
;
%
disp(['MASK
V
:',num2str(mask
v
(j,i))])
disp
([
'MASK:'
,
num2str
(
mask
(
j
,
i
))])
end
%disp(['--'])
j
=
j
-
1
;
%disp(['MASKV:',num2str(maskv(j,i))])
elseif
dir
(
2
)
==-
1
%nord-sud => TESTED
while
maskv
(
j
,
i
)
~=
1
disp
([
'--^^ start inland'
])
disp
([
'MASK:'
,
num2str
(
mask
(
j
,
i
))])
disp
([
'MASKV:'
,
num2str
(
maskv
(
j
,
i
))])
elseif
dir
(
2
)
==
-
1
% v : nord-sud => TESTED
while
mask
(
j
,
i
)
~=
1
j
=
j
-
1
;
%
disp(['MASK
V
:',num2str(mask
v
(j,i))])
disp
([
'MASK:'
,
num2str
(
mask
(
j
,
i
))])
end
%
disp(['--'])
j
=
j
+
1
;
%
disp(['MASKV:',num2str(maskv(j,i))])
disp
([
'--'
])
disp
([
'MASK:'
,
num2str
(
mask
(
j
,
i
))])
disp
([
'MASKV:'
,
num2str
(
maskv
(
j
,
i
))])
end
end
end
% from matlab to roms index convention
j2
=
j
;
i2
=
i
;
j2for
=
j
-
1
;
i2for
=
i
-
1
;
% regarding the flow direction, sense and landmask surrounding
% -- toward west >>
if
(
dir
(
1
)
==
0
&
dir
(
2
)
==
1
)
;
j2for_out
=
j2for
;
i2for_out
=
i2for
;
end
% -- toward est <<
if
(
dir
(
1
)
==
0
&
dir
(
2
)
==
-
1
);
j2for_out
=
j2for
;
i2for_out
=
i2for
+
1
;
end
% -- toward north ^^
if
(
dir
(
1
)
==
1
&
dir
(
2
)
==
1
);
j2for_out
=
j2for
;
i2for_out
=
i2for
;
end
% -- toward south vv
if
(
dir
(
1
)
==
1
&
dir
(
2
)
==
-
1
);
j2for_out
=
j2for
+
1
;
i2for_out
=
i2for
;
end
% j2mat_out is equal to j2for_out
% i2mat_out is equal to j2for_out % I think ...
% j2mat_out = j2for_out
% i2mat_out = i2for_out
return
This diff is collapsed.
Click to expand it.
Rivers/make_runoff.m
+
148
−
179
View file @
d8d427ee
This diff is collapsed.
Click to expand it.
Rivers/runoff_glob_extract.m
+
10
−
7
View file @
d8d427ee
...
...
@@ -42,12 +42,9 @@ close(ncriv)
maxmaxflow
=
(
max
(
max
(
FLOW_clm
)));
maxflow
=
(
max
(
FLOW_clm
)
'
);
% attention transpose
meanflowmax
=
mean
(
FLOW_clm
(:,
1
));
% pour amazon
meanflow
=
nanmean
(
FLOW_clm
(:,:),
1
)
'
;
% pour les autres
%size(meanflow)
%plot(meanflow)
%size(maxflow)
meanflowmax
=
mean
(
FLOW_clm
(:,
1
));
% for the biggest
meanflow
=
nanmean
(
FLOW_clm
(:,:),
1
)
'
;
% for others
%
%==========================================================================================================
%% => by default : all rivers in the domain
...
...
@@ -55,12 +52,18 @@ rivdetectype='DEFAULT';
my_riv
=
find
(
latriv_mou
>=
minlat
&
latriv_mou
<=
maxlat
&
lonriv_mou
>=
minlon
&
lonriv_mou
<=
maxlon
);
%==
% => megatl : rivers in the boxes + max value >= 20%*max val of the flow amazonia peak)
%rivdetectype='MEGATL';
%thold=0.1;
%thold=0.03;
%my_riv=find(latriv_mou>=minlat & latriv_mou<=maxlat & lonriv_mou >= minlon & lonriv_mou <= maxlon & meanflow >= thold.*meanflowmax);
% % => arvor : rivers in the boxes + max value >= 20%*max val of the flow orinoco peak)
% rivdetectype='ARVOR';
% %thold=0.1;
% thold=0.03;
% my_riv=find(latriv_mou>=minlat & latriv_mou<=maxlat & lonriv_mou >= minlon & lonriv_mou <= maxlon & meanflow >= thold.*meanflowmax);
%========================================
%
disp
([
'There are '
,
num2str
(
length
(
my_riv
)),
' rivers in the domain : '
])
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment