多次元座標を使用するnetcdfファイルがあります。私xarrayデータセットは、私は物理座標を介してデータのサブセットを取得するために期待しています。このpython xarrayを使用して多次元座標を使用してデータをサブセット化する方法は?
<xarray.Dataset>
Dimensions: (Time: 48, bottom_top: 50, bottom_top_stag: 51,
soil_layers_stag: 4, south_north: 1015, south_north_stag: 1016, west_east: 1359, west_east_stag: 1360)
Coordinates:
XLAT (Time, south_north, west_east) float32 18.1363 18.1456 ...
XLAT_U (Time, south_north, west_east_stag) float32 18.1316 ...
XLAT_V (Time, south_north_stag, west_east) float32 18.1198 ...
XLONG (Time, south_north, west_east) float32 -122.884 ...
XLONG_U (Time, south_north, west_east_stag) float32 -122.901 ...
XLONG_V (Time, south_north_stag, west_east) float32 -122.879 ...
* Time (Time) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ...
* south_north (south_north) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 ...
* west_east (west_east) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 ...
* bottom_top (bottom_top) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 ...
Data variables:
GRAUPEL_ACC_NC (Time, south_north, west_east) float32 0.0 0.0 0.0 0.0 ...
P (Time, south_north, west_east) float32 101112.0 ...
PREC_ACC_NC (Time, south_north, west_east) float32 0.0 0.0 0.0 0.0 ...
QVAPOR (Time, south_north, west_east) float32 0.0120251 ...
SNOW_ACC_NC (Time, south_north, west_east) float32 0.0 0.0 0.0 0.0 ...
TK (Time, south_north, west_east) float32 295.372 295.367 ...
Z (Time, south_north, west_east) float32 0.0 0.0 0.0 0.0 ...
(XLAT & XLONG)のように見えます。たとえば、TKをサブセット化して、49〜55Nおよび-125〜-115Wのグリッドポイントを取得します。
データのスライシングは機能しません。 TK [782:898,179:409]スライスされたグリッドポイントは、必要な緯度と経度の一定の線に沿っていないためです。
groupby.binsを使用した例がありましたが、私はそれを全く理解できませんでした。私はまた、ドメイン外の値をマスクする場所を使用しようとしましたが、成功しませんでした。
誰かが何か提案があれば、それは非常に感謝しています!
クイックヘルプ@shoyer!私はTK [0] [:] [:]を使用してインデックスを作成することで、時間配列を簡単に削除することができます。どのようにして、xarrayを介してデータセット全体でTimeディメンションを削除/削除しますか? – jdiction
フォローアップの質問については、http://stackoverflow.com/questions/41836190を参照してください。 – shoyer