如何从文件中提取单个变量?

时间:2016-08-01 18:20:13

标签: python terminal netcdf

我正在尝试从这些数据中提取单个变量,它将告诉我雷达数据的温度和高度,我正试图从Linux终端运行它,但它一直给我错误信息说“没有相应的文件和目录。”这是我的代码:

ls DataData
cd Desktop
python DataData.py

以下是文件的内容:

<xarray.Dataset>
Dimensions:              
(Time: 6, bottom_top: 99, bottom_top_stag: 100, soil_layers_stag: 5, south_north: 128, south_north_stag: 129, west_east: 128, west_east_stag: 129)
Coordinates:
XLAT                 (Time, south_north, west_east) float32 18.0 18.0 ...
XLONG                (Time, south_north, west_east) float32 -62.0 -62.0 ...
XLAT_U               (Time, south_north, west_east_stag) float32 0.0 0.0 ...
XLONG_U              (Time, south_north, west_east_stag) float32 0.0 0.0 ...
XLAT_V               (Time, south_north_stag, west_east) float32 0.0 0.0 ...
XLONG_V              (Time, south_north_stag, west_east) float32 0.0 0.0 ...
 Time                 (Time) int64 0 1 2 3 4 5
 bottom_top           (bottom_top) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 13 ...
 bottom_top_stag      (bottom_top_stag) int64 0 1 2 3 4 5 6 7 8 9 10 11 ...
 soil_layers_stag     (soil_layers_stag) int64 0 1 2 3 4
 south_north          (south_north) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 13 ...
 south_north_stag     (south_north_stag) int64 0 1 2 3 4 5 6 7 8 9 10 11 ...
 west_east            (west_east) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 13 ...
 west_east_stag       (west_east_stag) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 ...

Data variables:
Times                (Time) |S19 b'2004-12-16_02:00:00' ...
LU_INDEX             (Time, south_north, west_east) float32 0.0 0.0     0.0 ...
ZNU                  (Time, bottom_top) float32 0.994949 0.984848 ...
ZNW                  (Time, bottom_top_stag) float32 1.0 0.989899 ...
ZS                   (Time, soil_layers_stag) float32 0.0 0.0 0.0 0.0 ...
DZS                  (Time, soil_layers_stag) float32 0.0 0.0 0.0 0.0 ...
VAR_SSO              (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
LAP_HGT              (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
U                    (Time, bottom_top, south_north, west_east_stag)   float32 -8.0977 ...
V                    (Time, bottom_top, south_north_stag, west_east) float32 -4.92184 ...
W                    (Time, bottom_top_stag, south_north, west_east) float32 -0.0 ...
PH                   (Time, bottom_top_stag, south_north, west_east) float32 0.0 ...
PHB                  (Time, bottom_top_stag, south_north, west_east) float32 0.0 ...
T                    (Time, bottom_top, south_north, west_east) float32 -2.18884 ...
HFX_FORCE            (Time) float32 0.0 0.0 0.0 0.0 0.0 0.0
LH_FORCE             (Time) float32 0.0 0.0 0.0 0.0 0.0 0.0
TSK_FORCE            (Time) float32 0.0 0.0 0.0 0.0 0.0 0.0
HFX_FORCE_TEND       (Time) float32 0.0 0.0 0.0 0.0 0.0 0.0
LH_FORCE_TEND        (Time) float32 0.0 0.0 0.0 0.0 0.0 0.0
TSK_FORCE_TEND       (Time) float32 0.0 0.0 0.0 0.0 0.0 0.0
MU                   (Time, south_north, west_east) float32 -437.29 ...
MUB                  (Time, south_north, west_east) float32 38601.9 ...
NEST_POS             (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
TKE                  (Time, bottom_top, south_north, west_east) float32 0.0961436 ...
P                    (Time, bottom_top, south_north, west_east) float32 88.3828 ...
PB                   (Time, bottom_top, south_north, west_east) float32 101345.0 ...
FNM                  (Time, bottom_top) float32 0.0 0.5 0.500001 ...
FNP                  (Time, bottom_top) float32 0.0 0.5 0.499999 ...
RDNW                 (Time, bottom_top) float32 -98.9999 -98.9999 ...
RDN                  (Time, bottom_top) float32 0.0 -98.9999 -99.0002 ...
DNW                  (Time, bottom_top) float32 -0.010101 -0.010101 ...
DN                   (Time, bottom_top) float32 0.0 -0.010101 -0.010101 ...
CFN                  (Time) float32 1.5 1.5 1.5 1.5 1.5 1.5
CFN1                 (Time) float32 -0.5 -0.5 -0.5 -0.5 -0.5 -0.5
P_HYD                (Time, bottom_top, south_north, west_east) float32 101339.0 ...
Q2                   (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
T2                   (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
TH2                  (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
PSFC                 (Time, south_north, west_east) float32 101535.0 ...
U10                  (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
V10                  (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
RDX                  (Time) float32 0.01 0.01 0.01 0.01 0.01 0.01
RDY                  (Time) float32 0.01 0.01 0.01 0.01 0.01 0.01
RESM                 (Time) float32 0.0 0.0 0.0 0.0 0.0 0.0
ZETATOP              (Time) float32 0.0 0.0 0.0 0.0 0.0 0.0
CF1                  (Time) float32 2.0 2.0 2.0 2.0 2.0 2.0
CF2                  (Time) float32 -1.5 -1.5 -1.5 -1.5 -1.5 -1.5
CF3                  (Time) float32 0.500002 0.500002 0.500002 0.500002 ...
ITIMESTEP            (Time) int32 14400 15600 16800 18000 19200 20400
XTIME                (Time) float32 120.0 130.0 140.0 150.0 160.0 170.0
QVAPOR               (Time, bottom_top, south_north, west_east) float32 0.0167233 ...
QCLOUD               (Time, bottom_top, south_north, west_east) float32 0.0 ...
QRAIN                (Time, bottom_top, south_north, west_east) float32 1.40266e-12 ...
QICE                 (Time, bottom_top, south_north, west_east) float32 0.0 ...
QSNOW                (Time, bottom_top, south_north, west_east) float32 0.0 ...
QGRAUP               (Time, bottom_top, south_north, west_east) float32 0.0 ...
QHAIL                (Time, bottom_top, south_north, west_east) float32 0.0 ...
QNWFA2D              (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
QNCCN                (Time, bottom_top, south_north, west_east) float32 0.0 ...
QNCLOUD              (Time, bottom_top, south_north, west_east) float32 0.0 ...
QNRAIN               (Time, bottom_top, south_north, west_east) float32 0.00523219 ...
QNICE                (Time, bottom_top, south_north, west_east) float32 0.0 ...
QNSNOW               (Time, bottom_top, south_north, west_east) float32 0.0 ...
QNGRAUPEL            (Time, bottom_top, south_north, west_east) float32 0.0 ...
QNHAIL               (Time, bottom_top, south_north, west_east) float32 0.0 ...
QVGRAUPEL            (Time, bottom_top, south_north, west_east) float32 0.0 ...
SHDMAX               (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
SHDMIN               (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
SNOALB               (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
TSLB                 (Time, soil_layers_stag, south_north, west_east) float32 0.0 ...
SMOIS                (Time, soil_layers_stag, south_north, west_east) float32 0.0 ...
SH2O                 (Time, soil_layers_stag, south_north, west_east) float32 0.0 ...
SMCREL               (Time, soil_layers_stag, south_north, west_east) float32 0.0 ...
SEAICE               (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
XICEM                (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
SFROFF               (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
UDROFF               (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
IVGTYP               (Time, south_north, west_east) int32 0 0 0 0 0 0 0 ...
ISLTYP               (Time, south_north, west_east) int32 0 0 0 0 0 0 0 ...
VEGFRA               (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
GRDFLX               (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
ACGRDFLX             (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
ACSNOM               (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
SNOW                 (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
SNOWH                (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
CANWAT               (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
SSTSK                (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
COSZEN               (Time, south_north, west_east) float32 -0.871705 ...
LAI                  (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
VAR                  (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
MAPFAC_M             (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
MAPFAC_U             (Time, south_north, west_east_stag) float32 0.0 0.0 ...
MAPFAC_V             (Time, south_north_stag, west_east) float32 0.0 0.0 ...
MAPFAC_MX            (Time, south_north, west_east) float32 1.0 1.0 1.0 ...
MAPFAC_MY            (Time, south_north, west_east) float32 1.0 1.0 1.0 ...
MAPFAC_UX            (Time, south_north, west_east_stag) float32 1.0 1.0 ...
MAPFAC_UY            (Time, south_north, west_east_stag) float32 1.0 1.0 ...
MAPFAC_VX            (Time, south_north_stag, west_east) float32 1.0 1.0 ...
MF_VX_INV            (Time, south_north_stag, west_east) float32 1.0 1.0 ...
MAPFAC_VY            (Time, south_north_stag, west_east) float32 1.0 1.0 ...
F                    (Time, south_north, west_east) float32 4.49e-05 ...
E                    (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
SINALPHA             (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
COSALPHA             (Time, south_north, west_east) float32 1.0 1.0 1.0 ...
HGT                  (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
 TSK                  (Time, south_north, west_east) float32 299.8 299.8 ...
 P_TOP                (Time) float32 62938.1 62938.1 62938.1 62938.1 ...
 T00                  (Time) float32 0.0 0.0 0.0 0.0 0.0 0.0
 P00                  (Time) float32 0.0 0.0 0.0 0.0 0.0 0.0
 TLP                  (Time) float32 0.0 0.0 0.0 0.0 0.0 0.0
 TISO                 (Time) float32 0.0 0.0 0.0 0.0 0.0 0.0
 MAX_MSTFX            (Time) float32 0.0 0.0 0.0 0.0 0.0 0.0
 MAX_MSTFY            (Time) float32 0.0 0.0 0.0 0.0 0.0 0.0
 RAINC                (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
RAINSH               (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
RAINNC               (Time, south_north, west_east) float32 0.120844 ...
SNOWNC               (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
GRAUPELNC            (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
HAILNC               (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
REFL_10CM            (Time, bottom_top, south_north, west_east) float32 0.0 ...
CLDFRA               (Time, bottom_top, south_north, west_east) float32 0.0 ...
SWDOWN               (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
GLW                  (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
SWNORM               (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
OLR                  (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
ALBEDO               (Time, south_north, west_east) float32 0.08 0.08 ...
CLAT                 (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
ALBBCK               (Time, south_north, west_east) float32 0.08 0.08 ...
EMISS                (Time, south_north, west_east) float32 0.98 0.98 ...
NOAHRES              (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
TMN                  (Time, south_north, west_east) float32 298.95 ...
XLAND                (Time, south_north, west_east) float32 2.0 2.0 2.0 ...
UST                  (Time, south_north, west_east) float32 0.335208 ...
PBLH                 (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
HFX                  (Time, south_north, west_east) float32 8.70271 ...
QFX                  (Time, south_north, west_east) float32 6.01207e-05 ...
LH                   (Time, south_north, west_east) float32 150.302 ...
ACHFX                (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
ACLHF                (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
SNOWC                (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
SR                   (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
SAVE_TOPO_FROM_REAL  (Time) int32 0 0 0 0 0 0
AFWA_CLOUD_CEIL      (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
AFWA_CAPE            (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
AFWA_ZLFC            (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
AFWA_PLFC            (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
MIDRH_MIN            (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
AFWA_HAIL            (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
AFWA_LLWS            (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
AFWA_TORNADO         (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
SEED1                (Time) int32 0 0 0 0 0 0
SEED2                (Time) int32 0 0 0 0 0 0
LANDMASK             (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
LAKEMASK             (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
SST                  (Time, south_north, west_east) float32 299.8 299.8 ...
SST_INPUT            (Time, south_north, west_east) float32 0.0 0.0 0.0 ...
Attributes:
TITLE:  OUTPUT FROM WRF V3.6 MODEL
START_DATE: 2004-12-16_02:00:00
SIMULATION_START_DATE: 2004-12-16_00:00:00
WEST-EAST_GRID_DIMENSION: 129
SOUTH-NORTH_GRID_DIMENSION: 129
BOTTOM-TOP_GRID_DIMENSION: 100
DX: 100.0
DY: 100.0
STOCH_FORCE_OPT: 0
GRIDTYPE: C
DIFF_OPT: 2
KM_OPT: 2
DAMP_OPT: 0
DAMPCOEF: 0.1
KHDIF: 500.0
KVDIF: 500.0
MP_PHYSICS: 18
RA_LW_PHYSICS: 0
RA_SW_PHYSICS: 0
SF_SFCLAY_PHYSICS: 1
SF_SURFACE_PHYSICS: 0
BL_PBL_PHYSICS: 0
CU_PHYSICS: 0
SF_LAKE_PHYSICS: 0
SURFACE_INPUT_SOURCE: 1
SST_UPDATE: 0
GRID_FDDA: 0
GFDDA_INTERVAL_M: 0
GFDDA_END_H: 0
GRID_SFDDA: 0
SGFDDA_INTERVAL_M: 0
SGFDDA_END_H: 0
HYPSOMETRIC_OPT: 2
SF_URBAN_PHYSICS: 0
SHCU_PHYSICS: 0
MFSHCONV: 0
FEEDBACK: 0
SMOOTH_OPTION: 1
SWRAD_SCAT: 1.0
W_DAMPING: 0
DT: 0.5
RADT: 0.0
BLDT: 0.0
CUDT: 0.0
AER_OPT: 0
SWINT_OPT: 0
AER_TYPE: 1
AER_AOD550_OPT: 1
AER_ANGEXP_OPT: 1
AER_SSA_OPT: 1
AER_ASY_OPT: 1
AER_AOD550_VAL: 0.12
AER_ANGEXP_VAL: 1.3
AER_SSA_VAL: 1.4013e-45
AER_ASY_VAL: 1.4013e-45
MOIST_ADV_OPT: 2
SCALAR_ADV_OPT: 2
TKE_ADV_OPT: 2
DIFF_6TH_OPT: 0
DIFF_6TH_FACTOR: 0.12
OBS_NUDGE_OPT: 0
BUCKET_MM: -1.0
BUCKET_J: -1.0
PREC_ACC_DT: 0.0
SF_OCEAN_PHYSICS: 0
ISFTCFLX: 0
ISHALLOW: 0
ISFFLX: 1
ICLOUD: 1
ICLOUD_CU: 0
TRACER_PBLMIX: 1
SCALAR_PBLMIX: 0
GRAV_SETTLING: 0
DFI_OPT: 0
WEST-EAST_PATCH_START_UNSTAG: 1
WEST-EAST_PATCH_END_UNSTAG: 128
WEST-EAST_PATCH_START_STAG: 1
WEST-EAST_PATCH_END_STAG: 129
SOUTH-NORTH_PATCH_START_UNSTAG: 1
SOUTH-NORTH_PATCH_END_UNSTAG: 128
SOUTH-NORTH_PATCH_START_STAG: 1
SOUTH-NORTH_PATCH_END_STAG: 129
BOTTOM-TOP_PATCH_START_UNSTAG: 1
BOTTOM-TOP_PATCH_END_UNSTAG: 99
BOTTOM-TOP_PATCH_START_STAG: 1
BOTTOM-TOP_PATCH_END_STAG: 100
GRID_ID: 1
PARENT_ID: 0
I_PARENT_START: 1
J_PARENT_START: 1
PARENT_GRID_RATIO: 1
CEN_LAT: 0.0
CEN_LON: 0.0
TRUELAT1: 0.0
TRUELAT2: 0.0
MOAD_CEN_LAT: 0.0
STAND_LON: 0.0
POLE_LAT: 0.0
POLE_LON: 0.0
GMT: 0.0
JULYR: 0
JULDAY: 1
MAP_PROJ: 0
MAP_PROJ_CHAR: Cartesian
MMINLU: 
NUM_LAND_CAT: 24
ISWATER: 0
ISLAKE: 0
ISICE: 0
ISURBAN: 0
ISOILWATER: 0

这是它给我错误消息[Errno 2]没有这样的文件或目录。我正在尝试使用此代码从文件中检索变量,如下所示:

python DataData.py -o EXPERIMENT_tas.nc --time-units="days since 1949-12-01_00:00:00" -v T2 wrfout1.nc wrfout2.nc ... wrfoutN.nc

如何让终端检索变量,这是用于获取变量的正确代码?

0 个答案:

没有答案
相关问题