Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Docker-in-Docker (DinD) capabilities of public runners deactivated.
More info
Open sidebar
IPSL
LMD
InTro
RoutingPP
Commits
8fca5eeb
Commit
8fca5eeb
authored
Jan 20, 2021
by
Anthony Schrapffer
Browse files
Update script for merging (error date + some smaller issues).
parent
87a7c8ce
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
+11
-8
Stations/AllStations.py
Stations/AllStations.py
+8
-5
Stations/MergeStations.py
Stations/MergeStations.py
+3
-3
No files found.
Stations/AllStations.py
View file @
8fca5eeb
...
...
@@ -556,11 +556,12 @@ def stnnbchecker(C) :
duploc
=
np
.
argmin
(
np
.
abs
(
stnnb
-
dup
))
dreg
=
int
(
stnnb
[
duploc
]
/
100000
)
dsubreg
=
int
((
stnnb
[
duploc
]
-
dreg
*
100000
)
/
1000
)
regstnnb
=
stnnb
[(
stnnb
>=
dup
)
&
(
stnnb
<
dreg
*
100000
+
(
dsubreg
+
1
)
*
1000
)]
regstnnb
=
stnnb
[(
stnnb
>=
dup
-
1000
)
&
(
stnnb
<
dreg
*
100000
+
(
dsubreg
+
1
)
*
1000
)]
if
regstnnb
.
shape
[
0
]
<
1
:
t
=
dreg
*
100000
+
(
subreg
[
i
]
+
1
)
*
1000
-
1
else
:
t
=
np
.
max
(
regstnnb
)
+
1
regnum
=
np
.
min
(
regstnnb
)
t
=
regnum
-
1
if
not
any
(
stnnb
==
t
)
:
stnnb
[
duploc
]
=
t
C
.
stations
[
duploc
].
Number
=
t
...
...
@@ -575,12 +576,14 @@ def stnnbchecker(C) :
if
np
.
count_nonzero
(
stnnb
<
0
)
>
999
:
subreg
[:]
=
subreg
[:]
-
1
mask
=
np
.
where
(
stnnb
<
0
)
for
i
in
np
.
nditer
(
mask
)
:
regstnnb
=
stnnb
[(
stnnb
>=
reg
[
i
]
*
100000
+
subreg
[
i
]
*
1000
)
&
(
stnnb
<
(
reg
[
i
]
+
1
)
*
100000
)]
if
len
(
mask
[
0
])
>
0
:
for
i
in
np
.
nditer
(
mask
)
:
regstnnb
=
stnnb
[(
stnnb
>=
dup
-
1000
)
&
(
stnnb
<
dreg
*
100000
+
(
dsubreg
+
1
)
*
1000
)]
if
regstnnb
.
shape
[
0
]
<
1
:
t
=
reg
[
i
]
*
100000
+
subreg
[
i
]
*
1000
else
:
t
=
np
.
max
(
regstnnb
)
+
1
regnum
=
np
.
min
(
regstnnb
)
t
=
regnum
-
1
if
not
any
(
stnnb
==
t
)
:
stnnb
[
i
]
=
t
C
.
stations
[
i
].
Number
=
stnnb
[
i
]
...
...
Stations/MergeStations.py
View file @
8fca5eeb
...
...
@@ -46,15 +46,15 @@ C=AS.stnnbchecker(C)
#
print
(
"Number of stations in A = "
,
A
.
nbstations
,
" in B = "
,
B
.
nbstations
,
" Merged set has : "
,
C
.
nbstations
)
print
(
"Time range of input : A="
,
A
.
FirstDate
(),
"-"
,
A
.
LastDate
(),
" B="
,
B
.
FirstDate
(),
"-"
,
B
.
LastDate
())
nbmonth
=
int
((
C
.
LastDate
()
-
C
.
FirstDate
()
).
days
/
365
)
*
12
+
12
nbmonth
=
int
((
C
.
LastDate
()
.
year
-
C
.
FirstDate
()
.
year
)
+
1
)
*
12
print
(
"Data coverd by merged dataset :"
,
C
.
FirstDate
(),
" to "
,
C
.
LastDate
(),
' or '
,
nbmonth
,
' month.'
)
AllDates
=
[]
y
=
C
.
FirstDate
().
year
m
=
1
d
=
15
for
i
in
range
(
nbmonth
):
dm
=
i
%
12
dy
=
int
((
i
-
dm
)
/
12
)
+
1
dm
=
i
%
12
dy
=
i
//
12
AllDates
.
append
(
datetime
.
datetime
(
y
+
dy
,
m
+
dm
,
d
))
#
C
.
dumpnetcdf
(
AllDates
,
OutFile
,
"Merge of "
+
FileA
+
" and "
+
FileB
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment