Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
csStandalone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SFB1114 A08
csStandalone
Commits
b3d3fe67
Commit
b3d3fe67
authored
Dec 13, 2023
by
HenryTux
Browse files
Options
Downloads
Patches
Plain Diff
updates
parent
bc456b70
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
calc_E.py
+3
-6
3 additions, 6 deletions
calc_E.py
calc_bound.py
+2
-4
2 additions, 4 deletions
calc_bound.py
calc_dist.py
+0
-3
0 additions, 3 deletions
calc_dist.py
main.py
+19
-15
19 additions, 15 deletions
main.py
with
24 additions
and
28 deletions
calc_E.py
+
3
−
6
View file @
b3d3fe67
...
@@ -16,12 +16,9 @@ chdir(dirname(abspath(__file__)))
...
@@ -16,12 +16,9 @@ chdir(dirname(abspath(__file__)))
from
sys
import
argv
,
path
from
sys
import
argv
,
path
import
numpy
as
np
import
numpy
as
np
path
.
append
(
"
../wp21/pyscripts/LIB
"
)
path
.
append
(
"
../wp21/pyscripts/LIB
"
)
import
plot
as
pp
import
calc
as
cc
import
calc
as
cc
import
data
as
dd
import
data
as
dd
import
matplotlib.pyplot
as
plt
from
datetime
import
datetime
from
datetime
import
datetime
import
itertools
# %% Get the data
# %% Get the data
...
@@ -37,7 +34,7 @@ fname = "traj" + date_0.strftime('_%Y%m%d_%H') + ".npy"
...
@@ -37,7 +34,7 @@ fname = "traj" + date_0.strftime('_%Y%m%d_%H') + ".npy"
trajs
=
np
.
load
(
trapath
+
fname
)
trajs
=
np
.
load
(
trapath
+
fname
)
t_sel
=
np
.
arange
(
0
,
trajs
.
shape
[
1
])
t_sel
=
np
.
arange
(
0
,
int
(
trajs
.
shape
[
1
]
/
2
)
+
1
)
z_coord_type
=
"
p
"
z_coord_type
=
"
p
"
...
@@ -61,13 +58,13 @@ T = trajs['T'][::n]
...
@@ -61,13 +58,13 @@ T = trajs['T'][::n]
H
=
cc
.
ptoh
(
P
,
1013.25
,
8.435
)
# standard atmosphere
H
=
cc
.
ptoh
(
P
,
1013.25
,
8.435
)
# standard atmosphere
k_p
=
cc
.
calc_k
(
U
/
1000
,
V
/
1000
,
Omg
/
100
)
#
k_p = cc.calc_k(U/1000, V/1000, Omg/100)
k_p
=
15
k_p
=
15
# k_h = cc.calc_k(U, V, cc.omg2w(Omg/100, T, P))
# k_h = cc.calc_k(U, V, cc.omg2w(Omg/100, T, P))
D
=
list
((
list
(),
list
(),
list
()))
D
=
list
((
list
(),
list
(),
list
()))
epsilon_opt
=
np
.
array
([
2
5
000
,
50000
,
100000
,
2
5
0000
,
500000
])
epsilon_opt
=
np
.
array
([
2
0
000
,
50000
,
100000
,
2
0
0000
,
500000
])
bound_meth
=
"
$
\\
alpha$
"
bound_meth
=
"
$
\\
alpha$
"
alpha
=
1e-3
alpha
=
1e-3
...
...
This diff is collapsed.
Click to expand it.
calc_bound.py
+
2
−
4
View file @
b3d3fe67
...
@@ -16,10 +16,8 @@ chdir(dirname(abspath(__file__)))
...
@@ -16,10 +16,8 @@ chdir(dirname(abspath(__file__)))
from
sys
import
argv
,
path
,
stdout
from
sys
import
argv
,
path
,
stdout
import
numpy
as
np
import
numpy
as
np
path
.
append
(
"
../wp21/pyscripts/LIB
"
)
path
.
append
(
"
../wp21/pyscripts/LIB
"
)
import
plot
as
pp
import
calc
as
cc
import
calc
as
cc
import
data
as
dd
import
data
as
dd
import
matplotlib.pyplot
as
plt
from
datetime
import
datetime
from
datetime
import
datetime
import
itertools
import
itertools
...
@@ -81,8 +79,8 @@ elif coord == "x, y, p (stereo)":
...
@@ -81,8 +79,8 @@ elif coord == "x, y, p (stereo)":
x
,
y
,
z
=
cc
.
coord_trans
(
Lon
,
Lat
,
P
,
"
None
"
,
1
,
proj
=
"
stereo
"
)
x
,
y
,
z
=
cc
.
coord_trans
(
Lon
,
Lat
,
P
,
"
None
"
,
1
,
proj
=
"
stereo
"
)
d_path
=
path
+
"
stereop
"
d_path
=
path
+
"
stereop
"
if
(
not
norm
):
if
(
not
norm
):
z
=
z
*
cc
.
calc_k
(
trajs
[
'
U
'
]
/
1000
,
trajs
[
'
V
'
]
/
1000
,
z
=
z
*
15
#
cc.calc_k(trajs['U']/1000, trajs['V']/1000,
trajs
[
'
OMEGA
'
]
/
100
)
#
trajs['OMEGA']/100)
elif
coord
==
"
x, y, h (stereo)
"
:
elif
coord
==
"
x, y, h (stereo)
"
:
x
,
y
,
z
=
cc
.
coord_trans
(
Lon
,
Lat
,
P
,
"
std_atm
"
,
1
,
proj
=
"
stereo
"
)
x
,
y
,
z
=
cc
.
coord_trans
(
Lon
,
Lat
,
P
,
"
std_atm
"
,
1
,
proj
=
"
stereo
"
)
d_path
=
path
+
"
stereoh
"
d_path
=
path
+
"
stereoh
"
...
...
This diff is collapsed.
Click to expand it.
calc_dist.py
+
0
−
3
View file @
b3d3fe67
...
@@ -16,12 +16,9 @@ chdir(dirname(abspath(__file__)))
...
@@ -16,12 +16,9 @@ chdir(dirname(abspath(__file__)))
from
sys
import
argv
,
path
from
sys
import
argv
,
path
import
numpy
as
np
import
numpy
as
np
path
.
append
(
"
../wp21/pyscripts/LIB
"
)
path
.
append
(
"
../wp21/pyscripts/LIB
"
)
import
plot
as
pp
import
calc
as
cc
import
calc
as
cc
import
data
as
dd
import
data
as
dd
import
matplotlib.pyplot
as
plt
from
datetime
import
datetime
from
datetime
import
datetime
import
itertools
# %% Get the data
# %% Get the data
...
...
This diff is collapsed.
Click to expand it.
main.py
+
19
−
15
View file @
b3d3fe67
...
@@ -32,11 +32,14 @@ n = 1
...
@@ -32,11 +32,14 @@ n = 1
force_calc
=
False
force_calc
=
False
date_0
=
datetime
(
201
6
,
4
,
30
,
12
)
date_0
=
datetime
(
201
7
,
1
,
25
,
0
)
fname
=
"
../wp21/era5/traj/
"
+
date_0
.
strftime
(
'
%Y/traj_%Y%m%d_%H
'
)
+
"
.npy
"
fname
=
"
../wp21/era5/traj/
"
+
date_0
.
strftime
(
'
%Y/traj_%Y%m%d_%H
'
)
+
"
.npy
"
B
=
dd
.
get_block_dat
(
date_0
)
B
=
dd
.
get_block_dat
(
date_0
)
coasts
=
dd
.
get_coasts
(
0
,
90
,
-
180
,
180
)
if
date_0
.
strftime
(
"
%Y
"
)
==
"
2016
"
:
coasts
=
dd
.
get_coasts
(
10
,
90
,
-
60
,
-
240
)
elif
date_0
.
strftime
(
"
%Y
"
)
==
"
2017
"
:
coasts
=
dd
.
get_coasts
(
10
,
90
,
120
,
-
60
)
#fname = "traj" + date_0.strftime('_%Y%m%d_%H') + ".npy"
#fname = "traj" + date_0.strftime('_%Y%m%d_%H') + ".npy"
path
=
"
./
"
+
date_0
.
strftime
(
"
dat_%Y%m%d_%H
"
)
+
"
/
"
+
str
(
n
)
+
"
/
"
path
=
"
./
"
+
date_0
.
strftime
(
"
dat_%Y%m%d_%H
"
)
+
"
/
"
+
str
(
n
)
+
"
/
"
...
@@ -46,7 +49,7 @@ if not exists(path):
...
@@ -46,7 +49,7 @@ if not exists(path):
trajs
=
np
.
load
(
fname
)
trajs
=
np
.
load
(
fname
)
if
argv
[
0
]
==
''
:
if
argv
[
0
]
==
''
:
direc
=
'
whole
'
direc
=
'
backward
'
else
:
else
:
direc
=
argv
[
1
]
direc
=
argv
[
1
]
...
@@ -59,8 +62,8 @@ elif direc=="forward":
...
@@ -59,8 +62,8 @@ elif direc=="forward":
plot_0
=
0
plot_0
=
0
elif
direc
==
"
backward
"
:
elif
direc
==
"
backward
"
:
t_sel
=
np
.
arange
(
0
,
int
(
trajs
.
shape
[
1
]
/
2
))
t_sel
=
np
.
arange
(
0
,
int
(
trajs
.
shape
[
1
]
/
2
)
+
1
)
plot_0
=
-
1
plot_0
=
int
(
trajs
.
shape
[
1
]
/
2
)
# t_sel = np.arange(73, 74)
# t_sel = np.arange(73, 74)
...
@@ -86,14 +89,14 @@ elev = 45
...
@@ -86,14 +89,14 @@ elev = 45
dist
=
7
dist
=
7
t_i
=
0
t_i
=
0
alpha
=
1e-3
alpha
=
1e-3
e
=
10
0000
e
=
2
0000
epsilon_opt
=
np
.
array
([
2
5
000
,
50000
,
100000
,
2
5
0000
,
500000
])
epsilon_opt
=
np
.
array
([
2
0
000
,
50000
,
100000
,
2
0
0000
,
500000
])
alph_opt
=
np
.
array
([
1e-4
,
2e-4
,
5e-4
,
0.001
,
0.002
,
0.005
,
0.01
,
0.05
,
alph_opt
=
np
.
array
([
1e-4
,
2e-4
,
5e-4
,
0.001
,
0.002
,
0.005
,
0.01
,
0.05
,
0.1
,
0.5
,
1
,
5
,
10
])
0.1
,
0.5
,
1
,
5
,
10
])
N_k
=
3
N_k
=
6
# u and v is in m/s, omg in P/s; result is in km/hPa
# u and v is in m/s, omg in P/s; result is in km/hPa
k_p
=
cc
.
calc_k
(
trajs
[
'
U
'
]
/
1000
,
trajs
[
'
V
'
]
/
1000
,
trajs
[
'
OMEGA
'
]
/
100
)
#
k_p = cc.calc_k(trajs['U']/1000, trajs['V']/1000, trajs['OMEGA']/100)
k_p
=
15
# Coordinates for visualization
# Coordinates for visualization
X
=
lon
X
=
lon
Y
=
lat
Y
=
lat
...
@@ -103,6 +106,7 @@ k_h = cc.calc_k(trajs['U'], trajs['V'], cc.omg2w(trajs['OMEGA']/100,
...
@@ -103,6 +106,7 @@ k_h = cc.calc_k(trajs['U'], trajs['V'], cc.omg2w(trajs['OMEGA']/100,
trajs
[
'
T
'
],
trajs
[
'
p
'
]))
trajs
[
'
T
'
],
trajs
[
'
p
'
]))
# %% Boundary
# %% Boundary
# if False:
# if False:
if
argv
[
0
]
==
''
or
argv
[
1
]
==
"
Boundary
"
:
if
argv
[
0
]
==
''
or
argv
[
1
]
==
"
Boundary
"
:
...
@@ -307,11 +311,11 @@ if True:
...
@@ -307,11 +311,11 @@ if True:
kclust
=
cc
.
kcluster_idx
(
E
,
N_k
)
kclust
=
cc
.
kcluster_idx
(
E
,
N_k
)
# upper case letters for visualization
# upper case letters for visualization
Xcs
,
Ycs
,
Zcs
=
cc
.
coord_trans
(
lon
,
lat
,
p
,
"
None
"
,
k_p
,
proj
=
"
stereo
"
)
Xcs
,
Ycs
,
Zcs
=
cc
.
coord_trans
(
lon
,
lat
,
p
,
"
None
"
,
1
,
proj
=
"
stereo
"
)
points
=
pp
.
plot_clustering
(
ax3dcs
,
Xcs
,
Ycs
,
Zcs
,
azim
,
elev
,
dist
,
t_i
,
points
=
pp
.
plot_clustering
(
ax3dcs
,
Xcs
,
Ycs
,
Zcs
,
azim
,
elev
,
dist
,
t_i
,
c
=
kclust
.
labels_
,
plot_0
=
False
,
c
=
kclust
.
labels_
,
plot_0
=
False
,
coord
=
"
stereo
"
,
mean_traj
=
True
,
block
=
B
,
coord
=
"
stereo
"
,
mean_traj
=
True
,
block
=
None
,
coast
=
coasts
)
coast
=
None
)
ax3dcs
.
invert_zaxis
()
ax3dcs
.
invert_zaxis
()
# Add widget items
# Add widget items
...
@@ -338,7 +342,7 @@ if True:
...
@@ -338,7 +342,7 @@ if True:
null_ax
=
fig_cs
.
add_axes
([
0.02
,
0.43
,
0.1
,
0.05
])
null_ax
=
fig_cs
.
add_axes
([
0.02
,
0.43
,
0.1
,
0.05
])
null_check
=
CheckButtons
(
null_ax
,
[
"
Plot start?
"
],
[
False
])
null_check
=
CheckButtons
(
null_ax
,
[
"
Plot start?
"
],
[
False
])
geo_ax
=
fig_cs
.
add_axes
([
0.1
,
0.43
,
0.1
,
0.05
])
geo_ax
=
fig_cs
.
add_axes
([
0.1
,
0.43
,
0.1
,
0.05
])
geo_check
=
CheckButtons
(
geo_ax
,
[
"
Plot features?
"
],
[
Tru
e
])
geo_check
=
CheckButtons
(
geo_ax
,
[
"
Plot features?
"
],
[
Fals
e
])
run_ax
=
fig_cs
.
add_axes
([
0.02
,
0.35
,
0.1
,
0.05
])
run_ax
=
fig_cs
.
add_axes
([
0.02
,
0.35
,
0.1
,
0.05
])
run_check2
=
Button
(
run_ax
,
"
Calculate
"
)
run_check2
=
Button
(
run_ax
,
"
Calculate
"
)
...
@@ -474,7 +478,7 @@ if True:
...
@@ -474,7 +478,7 @@ if True:
ax_spag
=
fig_spag
.
add_subplot
(
111
)
ax_spag
=
fig_spag
.
add_subplot
(
111
)
fig_spag
.
subplots_adjust
(
left
=
0.2
)
fig_spag
.
subplots_adjust
(
left
=
0.2
)
var_ax
=
fig_spag
.
add_axes
([
0.025
,
0.1
,
0.1
,
0.8
])
var_ax
=
fig_spag
.
add_axes
([
0.025
,
0.1
,
0.1
,
0.8
])
var_check
=
RadioButtons
(
var_ax
,
trajs
.
dtype
.
names
,
3
)
var_check
=
RadioButtons
(
var_ax
,
trajs
.
dtype
.
names
,
6
)
var_ax
.
set_title
(
"
Variable
"
)
var_ax
.
set_title
(
"
Variable
"
)
dat
=
trajs
[
var_check
.
value_selected
][::
n
,
t_sel
]
dat
=
trajs
[
var_check
.
value_selected
][::
n
,
t_sel
]
...
...
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