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
4de7b9164bdc249dce1ff1a5e3bc82ed9e81d65b to 26672420033689ebe495a243da31dc245848a9b5
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
26672420033689ebe495a243da31dc245848a9b5
Select Git revision
Swap
Target
pamtra/pamtra-insitu
Select target project
pamtra/pamtra-insitu
1 result
4de7b9164bdc249dce1ff1a5e3bc82ed9e81d65b
Select Git revision
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (2)
formating
· eae72e99
Nils-Arne Dreier
authored
9 months ago
eae72e99
convert coords to radiants
· 26672420
Nils-Arne Dreier
authored
9 months ago
26672420
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
components/groundstation.py
+14
-9
14 additions, 9 deletions
components/groundstation.py
with
14 additions
and
9 deletions
components/groundstation.py
View file @
26672420
...
...
@@ -7,12 +7,14 @@ from pathlib import Path
this_dir
=
Path
(
__file__
).
parent
def
lonlat
(
string
):
pair
=
string
.
split
(
"
,
"
)
return
(
float
(
pair
[
0
]),
float
(
pair
[
1
]))
parser
=
ArgumentParser
()
parser
.
add_argument
(
"
--descriptorfile
"
,
type
=
FileType
(
'
r
'
),
default
=
this_dir
.
parent
/
"
descriptorfiles
"
/
"
icon_1mom.py
"
,
help
=
""
)
parser
.
add_argument
(
"
--descriptorfile
"
,
type
=
FileType
(
'
r
'
),
default
=
this_dir
.
parent
/
"
descriptorfiles
"
/
"
icon_1mom.py
"
,
help
=
""
)
parser
.
add_argument
(
"
--coords
"
,
type
=
lonlat
,
nargs
=
"
+
"
,
required
=
True
,
help
=
"
Coordinates of the groundstations
"
)
parser
.
add_argument
(
"
--frequency
"
,
type
=
float
,
nargs
=
"
+
"
,
default
=
94
)
parser
.
add_argument
(
"
--dt
"
,
type
=
str
,
default
=
None
,
help
=
"
Timestep
"
)
...
...
@@ -20,26 +22,28 @@ parser.add_argument("--source_component", type=str, default="atmo_output", help=
parser
.
add_argument
(
"
--source_grid
"
,
type
=
str
,
default
=
"
icon_atmos_grid
"
,
help
=
"
grid name of the source grid
"
)
args
=
parser
.
parse_args
()
from
yac
import
YAC
,
UnstructuredGrid
,
Location
,
Field
,
TimeUnit
,
\
InterpolationStack
,
NNNReductionType
,
Reduction
,
Action
import
pyPamtra
yac
=
YAC
()
comp
=
yac
.
def_comp
(
"
pamtra
"
)
coords
=
np
.
ar
ra
y
(
args
.
coords
)
coords
=
np
.
deg2
ra
d
(
args
.
coords
)
ncoords
=
len
(
args
.
coords
)
grid
=
UnstructuredGrid
(
"
pamtra-grid
"
,
[
3
]
*
ncoords
,
[
*
coords
[:,
0
],
*
(
coords
[:,
0
]
+
0.1
),
*
coords
[:,
0
]],
[
*
coords
[:,
1
],
*
coords
[:,
1
],
*
(
coords
[:,
1
]
+
0.1
)],
[
*
coords
[:,
0
],
*
(
coords
[:,
0
]
+
0.1
),
*
coords
[:,
0
]],
[
*
coords
[:,
1
],
*
coords
[:,
1
],
*
(
coords
[:,
1
]
+
0.1
)],
np
.
array
(
list
(
zip
(
range
(
ncoords
),
range
(
ncoords
,
2
*
ncoords
),
range
(
2
*
ncoords
,
3
*
ncoords
)))).
ravel
())
points
=
grid
.
def_points
(
Location
.
CELL
,
coords
[:,
0
],
coords
[:,
1
])
coords
[:,
0
],
coords
[:,
1
])
yac
.
sync_def
()
#print(yac.get_field_names(*source), file=sys.stderr)
#
print(yac.get_field_names(*source), file=sys.stderr)
interp
=
InterpolationStack
()
interp
.
add_nnn
(
NNNReductionType
.
AVG
,
1
,
1.0
)
...
...
@@ -61,7 +65,8 @@ for name in ["temp", "pres", "qv", "qi", "qc", "qs", "qr", "qg", "z_ifc", "u", "
yac
.
enddef
()
with
open
(
args
.
descriptorfile
,
"
r
"
)
as
dfile
:
exec
(
dfile
.
read
())
# adds a variable "descriptorFile"
exec
(
dfile
.
read
())
# adds a variable "descriptorFile"
def
call_pamtra
(
temp
,
pres
,
qv
,
qi
,
qc
,
qs
,
qr
,
qg
,
z_ifc
,
u
,
v
,
w
,
datetime
):
...
...
@@ -81,13 +86,13 @@ def call_pamtra(temp, pres, qv, qi, qc, qs, qr, qg, z_ifc, u, v, w,
pamtra
.
runPamtra
(
args
.
frequency
)
pamtra
.
writeResultsToNetCDF
(
f
"
output_
{
datetime
}
.nc
"
,
xarrayCompatibleOutput
=
True
)
while
True
:
datetime
=
fields
[
"
temp
"
].
datetime
data
=
{}
for
v
,
f
in
fields
.
items
():
data
[
v
],
info
=
f
.
get
()
print
(
v
,
data
[
v
]
.
shape
,
file
=
sys
.
stderr
)
print
(
v
,
np
.
linalg
.
norm
(
data
[
v
]
)
,
file
=
sys
.
stderr
)
call_pamtra
(
**
data
,
datetime
=
datetime
)
if
info
==
Action
.
GET_FOR_RESTART
:
break
This diff is collapsed.
Click to expand it.