Exemplo n.º 1
0
 public NcAtt(NcAtt rhs)
 {
     nullObject = rhs.nullObject;
     myName     = rhs.myName;
     groupId    = rhs.groupId;
     varId      = rhs.varId;
 }
Exemplo n.º 2
0
        public NcGroupAtt PutAtt(NcAtt attr) {
            CheckNull();
            CheckDefine();
            NcType t = attr.GetNcType();

            if(NcByte.Instance.Equals(t)) {
                sbyte[] buffer = new sbyte[attr.GetAttLength()];
                attr.GetValues(buffer);
                NcCheck.Check(NetCDF.nc_put_att_schar(myId, NcAtt.NC_GLOBAL, attr.GetName(),  t.GetId(), attr.GetAttLength(), buffer));
                return GetAtt(attr.GetName());
            }

            if(NcUbyte.Instance.Equals(t)) {
                byte[] buffer = new byte[attr.GetAttLength()];
                attr.GetValues(buffer);
                NcCheck.Check(NetCDF.nc_put_att_uchar(myId, NcAtt.NC_GLOBAL, attr.GetName(),  t.GetId(), attr.GetAttLength(), buffer));
                return GetAtt(attr.GetName());
            }

            if(NcShort.Instance.Equals(t)) {
                Int16[] buffer = new Int16[attr.GetAttLength()];
                attr.GetValues(buffer);
                NcCheck.Check(NetCDF.nc_put_att_short(myId, NcAtt.NC_GLOBAL, attr.GetName(),  t.GetId(), attr.GetAttLength(), buffer));
                return GetAtt(attr.GetName());
            }

            if(NcUshort.Instance.Equals(t)) {
                UInt16[] buffer = new UInt16[attr.GetAttLength()];
                attr.GetValues(buffer);
                NcCheck.Check(NetCDF.nc_put_att_ushort(myId, NcAtt.NC_GLOBAL, attr.GetName(),  t.GetId(), attr.GetAttLength(), buffer));
                return GetAtt(attr.GetName());
            }

            if(NcInt.Instance.Equals(t)) {
                Int32[] buffer = new Int32[attr.GetAttLength()];
                attr.GetValues(buffer);
                NcCheck.Check(NetCDF.nc_put_att_int(myId, NcAtt.NC_GLOBAL, attr.GetName(),  t.GetId(), attr.GetAttLength(), buffer));
                return GetAtt(attr.GetName());
            }

            if(NcUint.Instance.Equals(t)) {
                UInt32[] buffer = new UInt32[attr.GetAttLength()];
                attr.GetValues(buffer);
                NcCheck.Check(NetCDF.nc_put_att_uint(myId, NcAtt.NC_GLOBAL, attr.GetName(),  t.GetId(), attr.GetAttLength(), buffer));
                return GetAtt(attr.GetName());
            }

            if(NcInt64.Instance.Equals(t)) {
                Int64[] buffer = new Int64[attr.GetAttLength()];
                attr.GetValues(buffer);
                NcCheck.Check(NetCDF.nc_put_att_longlong(myId, NcAtt.NC_GLOBAL, attr.GetName(),  t.GetId(), attr.GetAttLength(), buffer));
                return GetAtt(attr.GetName());
            }

            if(NcUint64.Instance.Equals(t)) {
                UInt64[] buffer = new UInt64[attr.GetAttLength()];
                attr.GetValues(buffer);
                NcCheck.Check(NetCDF.nc_put_att_ulonglong(myId, NcAtt.NC_GLOBAL, attr.GetName(),  t.GetId(), attr.GetAttLength(), buffer));
                return GetAtt(attr.GetName());
            }

            if(NcFloat.Instance.Equals(t)) {
                float[] buffer = new float[attr.GetAttLength()];
                attr.GetValues(buffer);
                NcCheck.Check(NetCDF.nc_put_att_float(myId, NcAtt.NC_GLOBAL, attr.GetName(),  t.GetId(), attr.GetAttLength(), buffer));
                return GetAtt(attr.GetName());
            }

            if(NcDouble.Instance.Equals(t)) {
                double[] buffer = new double[attr.GetAttLength()];
                attr.GetValues(buffer);
                NcCheck.Check(NetCDF.nc_put_att_double(myId, NcAtt.NC_GLOBAL, attr.GetName(),  t.GetId(), attr.GetAttLength(), buffer));
                return GetAtt(attr.GetName());
            }
            if(NcChar.Instance.Equals(t)) {
                string sBuffer = attr.GetValues();
                NcCheck.Check(NetCDF.nc_put_att_text(myId, NcAtt.NC_GLOBAL,attr.GetName(), sBuffer.Length, sBuffer));
                return GetAtt(attr.GetName());
            }
            return new NcGroupAtt();
        }
Exemplo n.º 3
0
 public NcAtt(NcAtt rhs) {
     nullObject = rhs.nullObject;
     myName = rhs.myName;
     groupId = rhs.groupId;
     varId = rhs.varId;
 }