Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Bw-bestperf
FuXi
Commits
24c3da0b
Commit
24c3da0b
authored
Jul 31, 2023
by
tpys
Browse files
print init_time and latitude
parent
43341968
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
inference_fuxi.py
inference_fuxi.py
+3
-3
make_input.py
make_input.py
+1
-1
No files found.
inference_fuxi.py
View file @
24c3da0b
...
@@ -8,7 +8,6 @@ import onnxruntime as ort
...
@@ -8,7 +8,6 @@ import onnxruntime as ort
ort
.
set_default_logger_severity
(
3
)
ort
.
set_default_logger_severity
(
3
)
parser
=
argparse
.
ArgumentParser
()
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'--model'
,
type
=
str
,
required
=
True
,
help
=
"FuXi onnx model dir"
)
parser
.
add_argument
(
'--model'
,
type
=
str
,
required
=
True
,
help
=
"FuXi onnx model dir"
)
parser
.
add_argument
(
'--input'
,
type
=
str
,
required
=
True
,
help
=
"The input data file, store in netcdf format"
)
parser
.
add_argument
(
'--input'
,
type
=
str
,
required
=
True
,
help
=
"The input data file, store in netcdf format"
)
...
@@ -17,7 +16,6 @@ parser.add_argument('--num_steps', type=int, nargs="+", default=[20, 20, 20])
...
@@ -17,7 +16,6 @@ parser.add_argument('--num_steps', type=int, nargs="+", default=[20, 20, 20])
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
def
time_encoding
(
init_time
,
total_step
,
freq
=
6
):
def
time_encoding
(
init_time
,
total_step
,
freq
=
6
):
init_time
=
np
.
array
([
init_time
])
init_time
=
np
.
array
([
init_time
])
tembs
=
[]
tembs
=
[]
...
@@ -89,8 +87,10 @@ def run_inference(model_dir, data, num_steps, save_dir=""):
...
@@ -89,8 +87,10 @@ def run_inference(model_dir, data, num_steps, save_dir=""):
init_time
=
pd
.
to_datetime
(
data
.
time
.
values
[
-
1
])
init_time
=
pd
.
to_datetime
(
data
.
time
.
values
[
-
1
])
tembs
=
time_encoding
(
init_time
,
total_step
)
tembs
=
time_encoding
(
init_time
,
total_step
)
input
=
data
.
values
[
None
]
print
(
f
'init_time:
{
init_time
.
strftime
((
"%Y%m%d-%H"
))
}
'
)
print
(
f
'latitude:
{
data
.
lat
.
values
[
0
]
}
~
{
data
.
lat
.
values
[
-
1
]
}
'
)
input
=
data
.
values
[
None
]
print
(
f
'input:
{
input
.
shape
}
,
{
input
.
min
():.
2
f
}
~
{
input
.
max
():.
2
f
}
'
)
print
(
f
'input:
{
input
.
shape
}
,
{
input
.
min
():.
2
f
}
~
{
input
.
max
():.
2
f
}
'
)
print
(
f
'tembs:
{
tembs
.
shape
}
,
{
tembs
.
mean
():.
4
f
}
'
)
print
(
f
'tembs:
{
tembs
.
shape
}
,
{
tembs
.
mean
():.
4
f
}
'
)
...
...
make_input.py
View file @
24c3da0b
...
@@ -4,7 +4,7 @@ import numpy as np
...
@@ -4,7 +4,7 @@ import numpy as np
import
pandas
as
pd
import
pandas
as
pd
import
xarray
as
xr
import
xarray
as
xr
__all__
=
[
'make_input'
]
__all__
=
[
'make_input'
,
'chunk_time'
]
def
chunk_time
(
ds
,
shape
=
None
):
def
chunk_time
(
ds
,
shape
=
None
):
...
...
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