示例#1
0
        private void _writeItemData(DfsUtilities df_in, ucar.nc2.NetcdfFileWriteable newNetcdfFile)
        {
            for (int itemCount = 0; itemCount < _settings.Variables.Count; itemCount++)
            {
                if (_settings.IsVariablesSelected[itemCount])
                {
                    ucar.ma2.ArrayDouble dataArr   = new ucar.ma2.ArrayDouble.D4(df_in.tAxis_nTSteps, df_in.Items[0].nPointsX, df_in.Items[0].nPointsY, df_in.Items[0].nPointsZ);
                    ucar.ma2.Index       dataIndex = dataArr.getIndex();
                    for (int i = 0; i < df_in.tAxis_nTSteps; i++)
                    {
                        float[] dfsData = null;
                        df_in.ReadDynData(i, itemCount + 1, out dfsData);

                        int dataCount = 0;
                        for (int l = 0; l < df_in.Items[0].nPointsZ; l++)
                        {
                            for (int j = 0; j < df_in.Items[0].nPointsY; j++)
                            {
                                for (int k = 0; k < df_in.Items[0].nPointsX; k++)
                                {
                                    dataArr.setDouble(dataIndex.set(i, k, j, l), dfsData[dataCount]);
                                    dataCount++;
                                }
                            }
                        }
                    }
                    newNetcdfFile.write(df_in.Items[itemCount].Name.Replace(' ', '_'), dataArr);
                }
            }
        }
示例#2
0
        private void _writeItemData(DfsUtilities df_in, ucar.nc2.NetcdfFileWriteable newNetcdfFile)
        {
            for (int itemCount = 0; itemCount < _settings.Variables.Count; itemCount++)
            {
                if (_settings.IsVariablesSelected[itemCount])
                {
                    ucar.ma2.ArrayDouble dataArr   = new ucar.ma2.ArrayDouble.D1(df_in.tAxis_nTSteps);
                    ucar.ma2.Index       dataIndex = dataArr.getIndex();
                    for (int i = 0; i < df_in.tAxis_nTSteps; i++)
                    {
                        float[] dfsData = null;
                        df_in.ReadDynData(i, itemCount + 1, out dfsData);

                        dataArr.setDouble(dataIndex.set(i), dfsData[0]);
                    }
                    newNetcdfFile.write(df_in.Items[itemCount].Name.Replace(' ', '_'), dataArr);
                }
            }
        }