import numpy as np
import pandas as pd
import xarray as xr
from reki.format.grib.eccodes import load_field_from_file/home/wangdp/project/cedarkit/notebook-project/notebook-devel/repo/data-notebook-project/data-notebook/.venv/lib/python3.14/site-packages/gribapi/__init__.py:23: UserWarning: ecCodes 2.42.0 or higher is recommended. You are running version 2.34.1
warnings.warn(
from data_notebook.data import get_data_file
gfs_grib2_orig_file_path = get_data_file("cma-gfs")
gfs_grib2_orig_file_pathPosixPath('/home/wangdp/project/cedarkit/notebook-project/notebook-devel/repo/data-notebook-project/data-notebook/data/cma-gfs/grib2/orig/Z_NAFP_C_BABJ_20260811000000_P_NWPC-GRAPES-GFS-GLB-02400.grib2')层次¶
30 层,单位百帕 mb:
1000
975
950
925
900
850
800
750
700
650
600
550
500
450
400
350
300
275
250
225
200
175
150
125
100
70
50
30
20
10
雷达反射率¶
| 要素名 | cemc | wgrib2 | eccodes | GRIB Key | 层次类型 | 层次 | 编号 |
|---|---|---|---|---|---|---|---|
| 雷达反射率 | dbz | - | - | (0, 16, 225) | pl | 30层 | 785-814 |
field = load_field_from_file(
gfs_grib2_orig_file_path,
parameter="dbz",
level_type="pl",
level=1000,
lazy=True
)
assert field.attrs["GRIB_count"] == 785field = load_field_from_file(
gfs_grib2_orig_file_path,
parameter="dbz",
level_type="pl",
level=850,
lazy=True
)
assert field.attrs["GRIB_count"] == 790The history saving thread hit an unexpected error (OperationalError('attempt to write a readonly database')).History will not be written to the database.
field = load_field_from_file(
gfs_grib2_orig_file_path,
parameter="dbz",
level_type="pl",
level=70,
lazy=True
)
assert field.attrs["GRIB_count"] == 810field = load_field_from_file(
gfs_grib2_orig_file_path,
parameter={
"discipline": 0,
"parameterCategory": 16,
"parameterNumber": 225,
},
level_type="pl",
level=10,
lazy=True
)
assert field.attrs["GRIB_count"] == 814cdbz/SHWINX/hi/wi/ht0/PWAT¶
雷达组合反射率¶
| 要素名 | cemc | wgrib2 | eccodes | GRIB Key | 层次类型 | 层次 | 编号 |
|---|---|---|---|---|---|---|---|
| 雷达组合反射率 | cdbz | - | - | (0, 16, 224) | surface | - | 815 |
field = load_field_from_file(
gfs_grib2_orig_file_path,
parameter="cdbz",
lazy=True
)
assert field.attrs["GRIB_count"] == 815field = load_field_from_file(
gfs_grib2_orig_file_path,
parameter={
"discipline": 0,
"parameterCategory": 16,
"parameterNumber": 224,
},
level_type="surface",
lazy=True
)
assert field.attrs["GRIB_count"] == 815沙氏指数¶
| 要素名 | cemc | wgrib2 | eccodes | GRIB Key | 层次类型 | 层次 | 编号 |
|---|---|---|---|---|---|---|---|
| 沙氏指数 | si | SHWINX | - | (0, 7, 13) | surface | - | 816 |
field = load_field_from_file(
gfs_grib2_orig_file_path,
parameter="SHWINX",
lazy=True
)
assert field.attrs["GRIB_count"] == 816field = load_field_from_file(
gfs_grib2_orig_file_path,
parameter="si",
lazy=True
)
assert field.attrs["GRIB_count"] == 816field = load_field_from_file(
gfs_grib2_orig_file_path,
parameter={
"discipline": 0,
"parameterCategory": 7,
"parameterNumber": 13,
},
level_type="surface",
lazy=True
)
assert field.attrs["GRIB_count"] == 816冰雹指数¶
| 要素名 | cemc | wgrib2 | eccodes | GRIB Key | 层次类型 | 层次 | 编号 |
|---|---|---|---|---|---|---|---|
| 冰雹指数 | hi | - | - | (0, 1, 239) | surface | - | 817 |
field = load_field_from_file(
gfs_grib2_orig_file_path,
parameter="hi",
lazy=True
)
assert field.attrs["GRIB_count"] == 817field = load_field_from_file(
gfs_grib2_orig_file_path,
parameter={
"discipline": 0,
"parameterCategory": 1,
"parameterNumber": 239,
},
level_type="surface",
lazy=True
)
assert field.attrs["GRIB_count"] == 817大风指数¶
| 要素名 | cemc | wgrib2 | eccodes | GRIB Key | 层次类型 | 层次 | 编号 |
|---|---|---|---|---|---|---|---|
| 大风指数 | wi | - | - | (0, 2, 236) | surface | - | 818 |
field = load_field_from_file(
gfs_grib2_orig_file_path,
parameter="wi",
lazy=True
)
assert field.attrs["GRIB_count"] == 818field = load_field_from_file(
gfs_grib2_orig_file_path,
parameter={
"discipline": 0,
"parameterCategory": 2,
"parameterNumber": 236,
},
level_type="surface",
lazy=True
)
assert field.attrs["GRIB_count"] == 8180度层高度¶
| 要素名 | cemc | wgrib2 | eccodes | GRIB Key | 层次类型 | 层次 | 编号 |
|---|---|---|---|---|---|---|---|
| 0度层高度 | ht0 | - | - | (0, 3, 225) | surface | - | 819 |
field = load_field_from_file(
gfs_grib2_orig_file_path,
parameter="ht0",
lazy=True
)
assert field.attrs["GRIB_count"] == 819field = load_field_from_file(
gfs_grib2_orig_file_path,
parameter={
"discipline": 0,
"parameterCategory": 3,
"parameterNumber": 225,
},
level_type="surface",
lazy=True
)
assert field.attrs["GRIB_count"] == 819整层可降水量¶
| 要素名 | cemc | wgrib2 | eccodes | GRIB Key | 层次类型 | 层次 | 编号 |
|---|---|---|---|---|---|---|---|
| 整层可降水量 | pwat | PWAT | pwat | (0, 1, 3) | atmosphere | - | 820 |
field = load_field_from_file(
gfs_grib2_orig_file_path,
parameter="PWAT",
level_type="atmosphere",
lazy=True
)
assert field.attrs["GRIB_count"] == 820field = load_field_from_file(
gfs_grib2_orig_file_path,
parameter="pwat",
lazy=True
)
assert field.attrs["GRIB_count"] == 820field = load_field_from_file(
gfs_grib2_orig_file_path,
parameter={
"discipline": 0,
"parameterCategory": 1,
"parameterNumber": 3,
},
level_type="atmosphere",
lazy=True
)
assert field.attrs["GRIB_count"] == 820湿位涡垂直分量¶
| 要素名 | cemc | wgrib2 | eccodes | GRIB Key | 层次类型 | 层次 | 编号 |
|---|---|---|---|---|---|---|---|
| 湿位涡垂直分量 | mpv1 | - | - | (0, 2, 225) | pl | 30层 | 821-850 |
field = load_field_from_file(
gfs_grib2_orig_file_path,
parameter="mpv1",
level_type="pl",
level=1000,
lazy=True
)
assert field.attrs["GRIB_count"] == 821field = load_field_from_file(
gfs_grib2_orig_file_path,
parameter="mpv1",
level_type="pl",
level=850,
lazy=True
)
assert field.attrs["GRIB_count"] == 826field = load_field_from_file(
gfs_grib2_orig_file_path,
parameter="mpv1",
level_type="pl",
level=70,
lazy=True
)
assert field.attrs["GRIB_count"] == 846field = load_field_from_file(
gfs_grib2_orig_file_path,
parameter={
"discipline": 0,
"parameterCategory": 2,
"parameterNumber": 225,
},
level_type="pl",
level=10,
lazy=True
)
assert field.attrs["GRIB_count"] == 850