Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pamtra-insitu
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
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
pamtra
pamtra-insitu
Compare revisions
c275349256261ec598cfd5447c98d41e45c61dc6 to 08280b575efe5a0a6b21b1e0001b4f7524d78acf
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
pamtra/pamtra-insitu
Select target project
No results found
08280b575efe5a0a6b21b1e0001b4f7524d78acf
Select Git revision
Swap
Target
pamtra/pamtra-insitu
Select target project
pamtra/pamtra-insitu
1 result
c275349256261ec598cfd5447c98d41e45c61dc6
Select Git revision
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (4)
record steps for installation
· ac1e42a0
Davide Ori
authored
4 weeks ago
ac1e42a0
created external tool python file
· a7c7ea1a
Davide Ori
authored
4 weeks ago
a7c7ea1a
example configuration yaml file
· e2aa7adb
Davide Ori
authored
4 weeks ago
e2aa7adb
modified send trajectory for profiles, trying to get arguments, and open trajectory file
· 08280b57
Davide Ori
authored
4 weeks ago
08280b57
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
comin/README.md
+42
-0
42 additions, 0 deletions
comin/README.md
comin/mpi_send_trajectory.py
+66
-13
66 additions, 13 deletions
comin/mpi_send_trajectory.py
comin/pamtra.yml
+22
-0
22 additions, 0 deletions
comin/pamtra.yml
comin/pamtra_run.py
+36
-0
36 additions, 0 deletions
comin/pamtra_run.py
with
166 additions
and
13 deletions
comin/README.md
0 → 100644
View file @
08280b57
## Steps to install
```
bash
git clone git@gitlab.dkrz.de:icon/icon-model.git
cd
icon-model/
mkdir
build
cd
build
spack load /fwvsvi
# this will need to be the same version as in the pamtraenv
spack load py-mpi4py@3.1.2
../config/dkrz/levante.gcc
--enable-comin
--enable-bundled-python
=
comin
make
-j6
ls
externals/comin/build/plugins/python_adapter/libpython_adapter.so
vim exp.haloac3_nwp_warmworld_comin.run
cat
/scratch/b/b381492/experiments/nwp/warmworld/20220316_comin/out.txt
INSTALL PAMTRA IN ENVIRONMENT AND PREPARE IT FOR PAMTRA INSITU
spack load /fwvsvi
# must be the same as used to install the comin python adapter
python
-m
venv pamtraenv
source
pamtraenv/bin/activate
pip
install
--upgrade
pip
install
--upgrade
pip
pip
install
--upgrade
numpy scipy matplotlib netcdf4 cython xarray meson pyyaml
# xarray, pyyaml are needed for pamtra-insitu
git clone https://github.com/igmk/pamtra.git
cd
pamtra
git checkout mesonpy
spack load /bcn7mbu
# gcc 11.2
spack load /tpmfvwu
# openblas 0.3.18 gcc 11.2
spack load /fnfhvr6
# fftw 3.10.10
spack load /jn6xcuy
# netcdf-fortran 4.6.1 gcc 11.2
pip
install
.
```
This diff is collapsed.
Click to expand it.
comin/mpi_send_trajectory.py
View file @
08280b57
import
comin
import
numpy
as
np
import
xarray
as
xr
from
mpi4py
import
MPI
from
scipy.spatial
import
KDTree
import
yaml
import
sys
jg
=
1
variables
=
[
"
temp
"
]
#from argparse import ArgumentParser
#parser = ArgumentParser()
#parser.add_argument("--num", type=str, help="this is an integer")
#parser.add_argument("--conf", type=str, help="this is the required yaml configuration file")
#args=parser.parse_args()
ymlfile
=
"
/home/b/b381492/warmworld/icon-model/build/run/pamtra-insitu/comin/pamtra.yml
"
with
open
(
ymlfile
,
'
r
'
)
as
conf
:
pamcfg
=
yaml
.
safe_load
(
conf
)
Number_of_platforms
=
len
(
pamcfg
[
'
platforms
'
])
platform
=
pamcfg
[
'
platforms
'
][
0
]
# TODO need to make it flexible
platform_name
=
platform
[
'
name
'
]
trajfile
=
platform
[
'
trajectoryFile
'
]
print
(
f
"
{
np
.
__version__
}
{
np
.
__path__
}
"
,
file
=
sys
.
stderr
)
#traj = xr.open_dataset(trajfile)
#print(traj, file=sys.stderr)
mic
=
pamcfg
[
'
microphysics
'
]
if
mic
==
'
icon_2
'
:
print
(
'
icon single moment microphysics with graupel
'
,
file
=
sys
.
stderr
)
vars3D
=
[
"
temp
"
]
#, "pres", "qv", "qi", "qc", "qs", "qr", "qg", "z_ifc", "u", "v", "w", "clc"]
elif
mic
==
'
icon_4
'
:
print
(
'
icon double moment microphysics
'
,
file
=
sys
.
stderr
)
vars3D
=
[
"
temp
"
]
#, "pres", "qv", "qi", "qc", "qs", "qr", "qg", "qh", "qni", "qnc", "qns", "qnr", "qng", "qnh", "z_ifc", "u", "v", "w"]
else
:
raise
ValueError
(
"
Unrecognized microphysical scheme {}
"
.
format
(
mic
))
vars2D
=
[
"
fr_land
"
]
def
trajectory
(
t
):
...
...
@@ -22,7 +53,7 @@ domain = comin.descrdata_get_domain(jg)
clon
=
np
.
asarray
(
domain
.
cells
.
clon
)
clat
=
np
.
asarray
(
domain
.
cells
.
clat
)
decomp_domain
=
np
.
asarray
(
domain
.
cells
.
decomp_domain
)
owner
=
decomp_domain
.
ravel
()
==
0
owner
=
decomp_domain
.
ravel
()
==
0
# this is a mask nproma*numcells????
xyz
=
np
.
c_
[
lonlat2xyz
(
clon
.
ravel
()[
owner
],
clat
.
ravel
()[
owner
])]
decomp_domain
=
np
.
asarray
(
domain
.
cells
.
decomp_domain
)
tree
=
KDTree
(
xyz
)
...
...
@@ -30,17 +61,28 @@ tree = KDTree(xyz)
plugin_comm
=
MPI
.
Comm
.
f2py
(
comin
.
parallel_get_plugin_mpi_comm
())
@comin.EP_SECONDARY_CONSTRUCTOR
@comin.
register_callback
(
comin
.
EP_SECONDARY_CONSTRUCTOR
)
def
secondary_constructor
():
global
comin_vars
comin_vars
=
{
v
:
comin
.
var_get
([
comin
.
EP_ATM_WRITE_OUTPUT_BEFORE
],
global
comin_vars3D
global
comin_vars2D
comin_vars3D
=
{
v
:
comin
.
var_get
([
comin
.
EP_ATM_WRITE_OUTPUT_BEFORE
],
(
v
,
jg
),
comin
.
COMIN_FLAG_READ
)
for
v
in
vars3D
}
comin_vars2D
=
{
v
:
comin
.
var_get
([
comin
.
EP_ATM_WRITE_OUTPUT_BEFORE
],
(
v
,
jg
),
comin
.
COMIN_FLAG_READ
)
for
v
in
variables
}
for
v
in
vars2D
}
def
ravel_not_height
(
arr3D
):
arr_sort
=
arr3D
.
transpose
((
1
,
0
,
2
,
3
,
4
))
return
arr_sort
.
reshape
(
arr_sort
.
shape
[
0
],
-
1
)
@comin.EP_ATM_WRITE_OUTPUT_BEFORE
@comin.register_callback
(
comin
.
EP_ATM_WRITE_OUTPUT_BEFORE
)
def
write_output_before
():
global
comin_vars
global
comin_vars2D
global
comin_vars3D
time
=
comin
.
current_get_datetime
()
lon
,
lat
=
trajectory
(
time
)
...
...
@@ -48,12 +90,23 @@ def write_output_before():
## check whether is inside domain
data
=
{
v
:
np
.
asarray
(
cv
)[:,
0
,
...].
ravel
()[
owner
][
ii
]
for
v
,
cv
in
comin_vars
.
items
()}
print
(
f
"
sending
{
data
}
"
)
plugin_comm
.
send
(
data
,
dest
=
0
)
# assume that the destination is always 0
data
=
np
.
asarray
(
comin_vars2D
[
'
fr_land
'
]).
ravel
()[
owner
]
#print(f"fr_land {data.shape} {ii} ", file=sys.stderr)
data
=
np
.
asarray
(
comin_vars3D
[
'
temp
'
])
#[:, 0, ...].ravel()[owner]
dato
=
ravel_not_height
(
data
)[:,
owner
][:,
ii
]
#print(f"temp {data.shape} {dato.shape} {owner.shape} ", file=sys.stderr)
#data3D = {v: np.asarray(cv)[:, 0, ...].ravel()[owner][ii]
# for v, cv in comin_vars3D.items()}
data3D
=
{
v
:
ravel_not_height
(
np
.
asarray
(
cv
))[:,
owner
][:,
ii
]
for
v
,
cv
in
comin_vars3D
.
items
()}
data2D
=
{
v
:
np
.
asarray
(
cv
).
ravel
()[
owner
][
ii
]
for
v
,
cv
in
comin_vars2D
.
items
()}
data3D
.
update
(
data2D
)
#print(f"sending {data3D}", file=sys.stderr)
plugin_comm
.
send
(
data3D
,
dest
=
0
)
# assume that the destination is always 0
@comin.EP_DESTRUCTOR
@comin.
register_callback
(
comin
.
EP_DESTRUCTOR
)
def
finalize
():
plugin_comm
.
send
(
None
,
dest
=
0
)
This diff is collapsed.
Click to expand it.
comin/pamtra.yml
0 → 100644
View file @
08280b57
---
# pamtra comin configuration
platforms
:
-
name
:
aircraft_1,
trajectoryFile
:
/home/b/b381492/gpsfiles/gps_20220316_RF06.nc
-
name
:
satellite_y,
trajectoryFile
:
/home/b/b381492/gpsfiles/gps_20220316_RF06.nc
instrumentList
:
[
MIRA35
,
HAMP-G
]
-
name
:
groundstation_00,
coordinatesDegrees
:
{
lat
:
11.9210
,
lon
:
78.923
}
instrumentList
:
[
Radar35
]
microphysics
:
icon_2
...
This diff is collapsed.
Click to expand it.
comin/pamtra_run.py
0 → 100644
View file @
08280b57
#!/usr/bin/env python3
import
numpy
as
np
import
xarray
as
xr
import
pandas
as
pd
import
sys
from
mpi_handshake
import
mpi_handshake
import
yaml
from
argparse
import
ArgumentParser
import
os
os
.
environ
[
'
PAMTRA_DATADIR
'
]
=
''
import
pyPamtra
parser
=
ArgumentParser
()
parser
.
add_argument
(
"
--conf
"
,
type
=
str
,
default
=
None
,
help
=
"
this is the required yaml configuration file
"
)
args
=
parser
.
parse_args
()
ymlfile
=
args
.
conf
with
open
(
ymlfile
,
'
r
'
)
as
conf
:
pamcfg
=
yaml
.
safe_load
(
conf
)
#print("This is pamtra_run", file=sys.stderr)
#print(pamcfg, file=sys.stderr)
#print("############", file=sys.stderr)
comin_comm
=
mpi_handshake
([
"
comin
"
])[
"
comin
"
]
pamtra_comm
=
mpi_handshake
([
"
pamtra
"
],
comm
=
comin_comm
)[
"
pamtra
"
]
while
True
:
data
=
pamtra_comm
.
recv
()
#print(data)
if
data
is
None
:
break
This diff is collapsed.
Click to expand it.