Example #1
0
        public void Open(String filename, FileType filetype)
        {
            Result c = Tell("close 1");
            Result co;
            switch (filetype)
            {
                case FileType.CTL:
                    co = Tell("open " + filename);
                    break;
                case FileType.SDF:
                    co = Tell("sdfopen " + filename);
                    break;
                default:
                    co = Tell("xdfopen " + filename);
                    break;
            }
            if (co.Status != 0)
                throw new Exception("Cannot open " + filename);

            x = new Dimension("X", this);
            lon = new Dimension("Lon", this);
            x.DimensionChanged += lon.OnDimensionChanged;
            lon.DimensionChanged += x.OnDimensionChanged;

            y = new Dimension("Y", this);
            lat = new Dimension("Lat", this);
            y.DimensionChanged += lat.OnDimensionChanged;
            lat.DimensionChanged += y.OnDimensionChanged;

            z = new Dimension("Z", this);
            lev = new Dimension("Lev", this);
            z.DimensionChanged += lev.OnDimensionChanged;
            lev.DimensionChanged += z.OnDimensionChanged;

            t = new Dimension("T", this);
            fileinfo = null;
        }
Example #2
0
 public void OnDimensionChanged(Dimension source)
 {
     Result co = grads.Tell("q dims");
     if (co.Status != 0)
         throw new Exception("Cannot query grads!");
     parse_output(co.Output);
 }