Ejemplo n.º 1
0
    internal Item(IntPtr ItemPointer, DFSBase DFS, int Number)
    {
      ItemNumber = Number;
      _dfs = DFS;
      int item_type = 0;
      int data_type = 0;
      int value_type = 0;
      
      IntPtr name = new IntPtr();
      IntPtr Eum = new IntPtr();

      this.ItemPointer = ItemPointer;
      DfsDLLAccess.dfsGetItemInfo_(ItemPointer, out item_type, ref name, ref Eum, out data_type);
      DfsDLLAccess.dfsGetItemValueType(ItemPointer, out value_type);
      NumberOfElements =(int) DfsDLLAccess.dfsGetItemElements(ItemPointer);

      DataType = (DfsSimpleType)data_type;
      valueType = (DataValueType)value_type;
      _name = (Marshal.PtrToStringAnsi(name));
      eumUnitString = Marshal.PtrToStringAnsi(Eum);
      if(item_type!=0)
        _eumitem = (eumItem)item_type;


    }
Ejemplo n.º 2
0
        internal Item(IntPtr ItemPointer, DFSBase DFS, int Number)
        {
            ItemNumber = Number;
            _dfs       = DFS;
            int item_type  = 0;
            int data_type  = 0;
            int value_type = 0;

            IntPtr name = new IntPtr();
            IntPtr Eum  = new IntPtr();

            this.ItemPointer = ItemPointer;
            DfsDLLAccess.dfsGetItemInfo_(ItemPointer, out item_type, ref name, ref Eum, out data_type);
            DfsDLLAccess.dfsGetItemValueType(ItemPointer, out value_type);
            NumberOfElements = (int)DfsDLLAccess.dfsGetItemElements(ItemPointer);


            valueType     = (DataValueType)value_type;
            _name         = (Marshal.PtrToStringAnsi(name));
            eumUnitString = Marshal.PtrToStringAnsi(Eum);
            if (item_type != 0)
            {
                _eumitem = (eumItem)item_type;
            }
        }
Ejemplo n.º 3
0
        public int Read(IntPtr pItem)
        {
            int           eumT = 0, eumU = 0;
            DfsSimpleType dataT = DfsSimpleType.Int;

            DfsDLLWrapper.dfsGetItemInfo(pItem, out eumT, out EUMTypeString, out Name, out eumU, out EUMUnitString, out dataT);

            EUMType  = (eumItem)eumT;
            EUMUnit  = (eumUnit)eumU;
            dataType = (DfsSimpleType)dataT;

            //if (dataType != UfsSimpleType.UFS_FLOAT)return err("Only float dataType supported.");

            dim = DfsDLLWrapper.dfsGetItemDim(pItem);

            dataValType = DfsDLLWrapper.dfsGetItemValueType(pItem);

            sAxisType = (SpaceAxisType)DfsDLLWrapper.dfsGetItemAxisType(pItem);
            switch (sAxisType)
            {
            case SpaceAxisType.EqD0:
                DfsDLLWrapper.dfsGetItemAxisEqD0(pItem, out eumU, out axisEUMUnitString);
                nPointsX = 1;
                break;

            case SpaceAxisType.EqD1:
                DfsDLLWrapper.dfsGetItemAxisEqD1(pItem, out eumU, out axisEUMUnitString, out m_nPointsX, out XMinLimit, out DX);
                break;

            case SpaceAxisType.EqD2:
                DfsDLLWrapper.dfsGetItemAxisEqD2(pItem, out eumU, out axisEUMUnitString, out m_nPointsX, out m_nPointsY, out XMinLimit, out YMinLimit, out DX, out DY);
                break;

            case SpaceAxisType.EqD3:
                DfsDLLWrapper.dfsGetItemAxisEqD3(pItem, out eumU, out axisEUMUnitString, out m_nPointsX, out m_nPointsY, out m_nPointsZ, out XMinLimit, out YMinLimit, out ZMinLimit, out DX, out DY, out DZ);
                break;

            default:
                return(_err("Unsupported space axis " + sAxisType.ToString()));
            }

            axisEUMUnit = (eumUnit)eumU;
            return(0);
        }
Ejemplo n.º 4
0
        /// <summary> Extract EUM quantity from NetCDF item </summary>
        private eumQuantity GetQuantityFromItem(Variable item)
        {
            eumItem eumitem = eumItem.eumIItemUndefined;
            eumUnit eumunit = eumUnit.eumUUnitUndefined;

            switch (item.Name)
            {
            case "Mean sea-level pressure": eumitem = eumItem.eumIPressure; break;

            case "10 metre U wind component": eumitem = eumItem.eumIWindVelocity; break;

            case "10 metre V wind component": eumitem = eumItem.eumIWindVelocity; break;
            }
            switch (item.Unit.ToLower())
            {
            case "m s**-1": eumunit = eumUnit.eumUmeterPerSec; break;

            case "pa": eumunit = eumUnit.eumUPascal; break;
            }
            return(new eumQuantity(eumitem, eumunit));
        }