问题描述
>>> dfForecastMSL
<xarray.Dataset>
Dimensions: (latitude: 1536,longitude: 3072,valid_time: 29)
Coordinates:
meanSea int64 0
time datetime64[ns] 2020-05-30
* longitude (longitude) float64 0.0 0.1172 0.2344 ... 359.6 359.8 359.9
* latitude (latitude) float64 89.91 89.79 89.68 ... -89.68 -89.79 -89.91
step (valid_time) timedelta64[ns] 0 days 00:00:00 ... 7 days 00:00:00
* valid_time (valid_time) datetime64[ns] 2020-05-30 ... 2020-06-06
Data variables:
msl (valid_time,latitude,longitude) float32 102246.484 ... 103826.81
Attributes:
GRIB_edition: 2
GRIB_centre: kwbc
GRIB_centreDescription: US National Weather Service - NCEP
GRIB_subCentre: 0
Conventions: CF-1.7
institution: US National Weather Service - NCEP
history: 2020-09-19T07:31:46 GRIB to CDM+CF via cfgrib-0....
>>> dfForecastMSL.history
'2020-09-19T07:31:46 GRIB to CDM+CF via cfgrib-0.9.8.4/ecCodes-2.17.0 with {"source": "/home/NCMRWFTEMP/vsprasad/EXP_HY2B/data/gdasv14/gdas/prodCNTL/gdas.20200530/gdas.t00z.master.grb2f00","filter_by_keys": {"cfVarName": "msl","typeOfLevel": "meanSea"},"encode_cf": ["parameter","time","geography","vertical"]}'
我正在尝试像这样提取我感兴趣的领域。
india = dfForecastMSL.sel(longitude=slice(60,100),latitude=slice(0,40))
输出看起来像....
>>> india = dfForecastMSL.sel(longitude=slice(60,40))
>>> india
<xarray.Dataset>
Dimensions: (latitude: 0,longitude: 342,valid_time: 29)
Coordinates:
meanSea int64 0
time datetime64[ns] 2020-05-30
* longitude (longitude) float64 60.0 60.12 60.23 60.35 ... 99.73 99.84 99.96
* latitude (latitude) float64
step (valid_time) timedelta64[ns] 0 days 00:00:00 ... 7 days 00:00:00
* valid_time (valid_time) datetime64[ns] 2020-05-30 ... 2020-06-06
Data variables:
msl (valid_time,longitude) float32
Attributes:
GRIB_edition: 2
GRIB_centre: kwbc
GRIB_centreDescription: US National Weather Service - NCEP
GRIB_subCentre: 0
Conventions: CF-1.7
institution: US National Weather Service - NCEP
history: 2020-09-19T07:31:46 GRIB to CDM+CF via cfgrib-0....
**为什么它缺少胶版纸? ** 还是我在做worn?
解决方法
似乎纬度坐标从+90保存到-90,因此以降序排列。切片必须以相同的顺序获取,因此应该为.sel(latitude=slice(40,0))
。