ある変数のメタデータ(attribute,次元の名前,座標)を別の変数にコピーするprocedure copy_VarMeta(from, to) 〔入力変数〕
a = new((/2,3,4,5/),float,100) a!0 = "time" a!1 = "lev" a!2 = "lat" a!3 = "lon" a@units = "m/s" b1 = new((/2,3,4/),float,200) b1@units = "kg" b2 = new((/3,4,5/),float,300) copy_VarMeta(a,b1) copy_VarMeta(a,b2) printVarSummary(b1) printVarSummary(b2) とすると, Variable: b1 Type: float Total Size: 96 bytes 24 values Number of Dimensions: 3 Dimensions and sizes: [time | 2] x [lev | 3] x [lat | 4] Coordinates: Number Of Attributes: 2 units : m/s _FillValue : 100 Variable: b2 Type: float Total Size: 240 bytes 60 values Number of Dimensions: 3 Dimensions and sizes: [time | 3] x [lev | 4] x [lat | 5] Coordinates: Number Of Attributes: 2 units : m/s _FillValue : 100 を得る。 a = new((/2,3,4,5/),float,100) a!0 = "time" a!1 = "lev" a!2 = "lat" a!3 = "lon" a&time = (/1,2/) ;;; timeの次元に座標を付ける a@units = "m/s" b1 = new((/2,3,4/),float,200) b1@units = "kg" b2 = new((/3,4,5/),float,300) copy_VarMeta(a,b1) copy_VarMeta(a,b2) printVarSummary(b1) printVarSummary(b2) のようにすると,b1については問題ないが,b2はエラーとなる。 |