Exemple #1
0
        public void TestSetBitmap()
        {
            using (GribFile file = new GribFile(Settings.REG_LATLON_GRB1))
            {
                var msg = file.First();

                int numVals = 10;
                double[] vals = new double[numVals];  
                double val = 42;

                for(int i =0; i < numVals; i++)
                {
                    vals[i] = val;
                }

                msg.HasBitmap = true;
                msg.SetValues(vals);
                double[] vals2;
                msg.Values(out vals2);

                for (int i = 0; i < numVals; i++)
                {
                    Assert.AreEqual(vals[i], vals2[i]);
                    Assert.AreEqual(val, vals2[i]);
                }                
            }
        }
Exemple #2
0
 public void TestIterateKeyValuePairs()
 {
     using (var file = new GribFile(Settings.SPHERICAL_PRESS_LVL)) {
         Assert.IsTrue(file.MessageCount > 0);
         Assert.IsTrue(file.First().Any());
     }
 }
Exemple #3
0
        public void TestOpenPng()
        {
            using (GribFile file = new GribFile(Settings.PNG_COMPRESSION))
            {
                Assert.IsTrue(file.MessageCount > 0);

                var msg = file.First();

                try
                {
                    Assert.IsTrue(msg["packingType"].AsString().ToLower().EndsWith("_png"));
                    Assert.IsTrue(msg.ValuesCount > 0);
                    Assert.IsTrue(msg.GeoSpatialValues.Any());
                    int i = 0;
                    foreach (var v in msg.GeoSpatialValues)
                    {
                        Assert.AreNotEqual(Double.NaN, v.Value);
                        if (i++ > 1000)
                        {
                            break;
                        }
                    }
                } catch (GribApiException e)
                {
                    Console.WriteLine(e.Message);
                    Console.WriteLine(msg.ShortName);
                    Console.WriteLine(msg.ToString());
                    Assert.IsTrue(false);
                }
            }
        }
Exemple #4
0
        public void TestSetBitmap()
        {
            using (GribFile file = new GribFile(Settings.REG_LATLON_GRB1))
            {
                var msg = file.First();

                int      numVals = 10;
                double[] vals    = new double[numVals];
                double   val     = 42;

                for (int i = 0; i < numVals; i++)
                {
                    vals[i] = val;
                }

                msg.HasBitmap = true;
                msg.SetValues(vals);
                double[] vals2;
                msg.Values(out vals2);

                for (int i = 0; i < numVals; i++)
                {
                    Assert.AreEqual(vals[i], vals2[i]);
                    Assert.AreEqual(val, vals2[i]);
                }
            }
        }
Exemple #5
0
 public void TestPrecision ()
 {
     var file = new GribFile(Settings.GAUSS);
     var msg = file.First();
     Assert.AreEqual(msg["bitsPerValue"].AsInt(), 13);
     msg.DecimalPrecision = 4;
     Assert.AreEqual(msg["bitsPerValue"].AsInt(), 20);
 }
Exemple #6
0
 public void TestIterateKeyValuePairs ()
 {
     using(var file = new GribFile(Settings.BIN))
     {
         Assert.IsTrue(file.MessageCount > 0);
         Assert.IsTrue(file.First().Any());
     }
 }
Exemple #7
0
 public void TestDumpNoError()
 {
     using (GribFile file = new GribFile(Settings.REG_LATLON_GRB1))
     {
         var msg = file.First();
         msg.Dump();
     }
 }
Exemple #8
0
        public void TestPrecision()
        {
            var file = new GribFile(Settings.GAUSS);
            var msg  = file.First();

            Assert.AreEqual(msg["bitsPerValue"].AsInt(), 13);
            msg.DecimalPrecision = 4;
            Assert.AreEqual(msg["bitsPerValue"].AsInt(), 20);
        }
Exemple #9
0
 public void TestPrecision()
 {
     using (var file = new GribFile(Settings.REG_GAUSSIAN_SURFACE_GRB2)) {
         var msg = file.First();
         Assert.AreEqual(msg["bitsPerValue"].AsInt(), 14);
         msg.DecimalPrecision = 4;
         Assert.AreEqual(msg["bitsPerValue"].AsInt(), 20);
     }
 }
Exemple #10
0
 public void TestSteographic()
 {
     using (GribFile file = new GribFile(Settings.STEREO)) {
         GribMessage msg = file.First();
         Assert.Greater(msg.ValuesCount, 1);
         foreach (GeoSpatialValue gs in msg.GeoSpatialValues)
         {
             Assert.Greater(gs.Latitude, 15);
         }
     }
 }
Exemple #11
0
        public void TestGetNativeType()
        {
            using (GribFile file = new GribFile(Settings.REG_LATLON_GRB1)) {
                var msg = file.First();
                Assert.AreEqual(msg["packingType"].NativeType, GribValueType.String);
                Assert.AreEqual(msg["longitudeOfFirstGridPointInDegrees"].NativeType, GribValueType.Double);
                Assert.AreEqual(msg["numberOfPointsAlongAParallel"].NativeType, GribValueType.Int);
                Assert.AreEqual(msg["values"].NativeType, GribValueType.DoubleArray);

                // TODO: test other types
            }
        }
Exemple #12
0
        public void TestGetGrib2()
        {
            double delta = 0.1d;

            using (GribFile file = new GribFile(Settings.REDUCED_LATLON_GRB2))
            {
                var msg = file.First();

                // "InDegrees" is a magic token that converts coordinate double values to degrees
                // explicit degree conversion via key name
                double latitudeOfFirstGridPointInDegrees = msg["latitudeOfFirstGridPoint"].AsDouble();
                Assert.AreEqual(latitudeOfFirstGridPointInDegrees, 90, delta);

                // degree conversion via accessor
                double longitudeOfFirstGridPointInDegrees = msg["longitudeOfFirstGridPoint"].AsDouble();
                Assert.AreEqual(longitudeOfFirstGridPointInDegrees, 0, delta);

                // degree conversion via accessor
                double latitudeOfLastGridPointInDegrees = msg["latitudeOfLastGridPoint"].AsDouble();
                Assert.AreEqual(latitudeOfLastGridPointInDegrees, -90, delta);

                // degree conversion via accessor
                double longitudeOfLastGridPointInDegrees = msg["longitudeOfLastGridPoint"].AsDouble();
                Assert.AreEqual(longitudeOfLastGridPointInDegrees, 360, .5);

                // degree conversion via accessor
                double jDirectionIncrementInDegrees = msg["jDirectionIncrement"].AsDouble();
                Assert.AreEqual(jDirectionIncrementInDegrees, 0.36, delta);

                // degree conversion via accessor
                double iDirectionIncrementInDegrees = msg["iDirectionIncrement"].AsDouble();
                Assert.AreEqual(iDirectionIncrementInDegrees, -1.0E+100, delta);

                int numberOfPointsAlongAParallel = msg["numberOfPointsAlongAParallel"].AsInt();
                Assert.AreEqual(numberOfPointsAlongAParallel, 0x7FFFFFFF);

                int numberOfPointsAlongAMeridian = msg["numberOfPointsAlongAMeridian"].AsInt();
                Assert.AreEqual(numberOfPointsAlongAMeridian, 501);

                string packingType = msg["packingType"].AsString();
                Assert.AreEqual("grid_simple", packingType);
            }
        }
Exemple #13
0
        public void TestEnumDisposal()
        {
            using (var file1 = new GribFile(Settings.COMPLEX_GRID))
                using (var file2 = new GribFile(Settings.TIME)) {
                    var msg1 = file1.First();
                    var msg2 = file2.First();

                    var msgEnumerator1 = msg1.GetEnumerator();
                    var msgEnumerator2 = msg2.GetEnumerator();
                    int i = 0;
                    while (msgEnumerator1.MoveNext() && msgEnumerator2.MoveNext())
                    {
                        i++;
                        Assert.IsNotEmpty(msgEnumerator1.Current.Key);
                        Assert.IsNotEmpty(msgEnumerator2.Current.Key);
                    }
                    Assert.IsTrue(i > 3);
                }
        }
Exemple #14
0
        public void TestWrite()
        {
            if (File.Exists(Settings.OUT_GRIB))
            {
                File.Delete(Settings.OUT_GRIB);
            }

            int count = 0;
            int valCount = 0;

            using (var readFile = new GribFile(Settings.PACIFIC_WIND))
            {
                var msg = readFile.First();
                Assert.AreNotEqual(33, msg["latitudeOfFirstGridPoint"].AsDouble());
                msg["latitudeOfFirstGridPoint"].AsDouble(33);
                valCount = msg.ValuesCount;
                GribFile.Write(Settings.OUT_GRIB, msg);
            }

            using (var readFile = new GribFile(Settings.OUT_GRIB))
            {
                var msg = readFile.First();
                count = readFile.MessageCount;
                Assert.AreEqual(valCount, msg.ValuesCount);
                Assert.AreEqual(count, readFile.MessageCount);
                Assert.AreEqual(33, msg["latitudeOfFirstGridPoint"].AsDouble());
            }

            using (var readFile = new GribFile(Settings.PACIFIC_WIND))
            {
                GribFile.Write(Settings.OUT_GRIB, readFile as IEnumerable<GribMessage>, FileMode.Append);
                count += readFile.MessageCount;
            }

            using (var readFile = new GribFile(Settings.OUT_GRIB))
            {
                Assert.AreEqual(count, readFile.MessageCount);
                Assert.AreEqual(33, readFile.First()["latitudeOfFirstGridPoint"].AsDouble());
            }
        }
Exemple #15
0
        public void TestSetBitmapMissing ()
        {
            using (GribFile file = new GribFile(Settings.REG_LATLON_GRB1))
            {
                var msg = file.First();
                int missing = 3333;
                // set the value used to represent missing data
                msg.MissingValue = missing;
                Assert.AreEqual(msg.MissingValue, missing);
                Assert.IsFalse(msg.HasBitmap);

                int numVals = 10;
                double[] vals = new double[numVals];                

                for (int i = 0; i < numVals; i++)
                {
                    vals[i] = missing;
                }

                msg.HasBitmap = true;
                msg.SetValues(vals);
                double[] vals2;
                msg.Values(out vals2);

                for (int i = 0; i < numVals; i++)
                {
                    Assert.AreEqual(vals[i], vals2[i]);
                    Assert.AreEqual(missing, vals2[i]);
                }

                missing = 9898;
                msg.MissingValue = missing;
                msg.Values(out vals);

                for (int i = 0; i < numVals; i++)
                {
                    Assert.AreEqual(missing, vals[i]);
                }
            }
        }
Exemple #16
0
        public void TestWrite()
        {
            if (File.Exists(Settings.OUT_GRIB))
            {
                File.Delete(Settings.OUT_GRIB);
            }

            int count    = 0;
            int valCount = 0;

            using (var readFile = new GribFile(Settings.PACIFIC_WIND))
            {
                var msg = readFile.First();
                Assert.AreNotEqual(33, msg["latitudeOfFirstGridPoint"].AsDouble());
                msg["latitudeOfFirstGridPoint"].AsDouble(33);
                valCount = msg.ValuesCount;
                GribFile.Write(Settings.OUT_GRIB, msg);
            }

            using (var readFile = new GribFile(Settings.OUT_GRIB))
            {
                var msg = readFile.First();
                count = readFile.MessageCount;
                Assert.AreEqual(valCount, msg.ValuesCount);
                Assert.AreEqual(count, readFile.MessageCount);
                Assert.AreEqual(33, msg["latitudeOfFirstGridPoint"].AsDouble());
            }

            using (var readFile = new GribFile(Settings.PACIFIC_WIND))
            {
                GribFile.Write(Settings.OUT_GRIB, readFile as IEnumerable <GribMessage>, FileMode.Append);
                count += readFile.MessageCount;
            }

            using (var readFile = new GribFile(Settings.OUT_GRIB))
            {
                Assert.AreEqual(count, readFile.MessageCount);
                Assert.AreEqual(33, readFile.First()["latitudeOfFirstGridPoint"].AsDouble());
            }
        }
Exemple #17
0
        public void TestSetBitmapMissing()
        {
            using (GribFile file = new GribFile(Settings.REG_LATLON_GRB1))
            {
                var msg     = file.First();
                int missing = 3333;
                // set the value used to represent missing data
                msg.MissingValue = missing;
                Assert.AreEqual(msg.MissingValue, missing);
                Assert.IsFalse(msg.HasBitmap);

                int      numVals = 10;
                double[] vals    = new double[numVals];

                for (int i = 0; i < numVals; i++)
                {
                    vals[i] = missing;
                }

                msg.HasBitmap = true;
                msg.SetValues(vals);
                double[] vals2;
                msg.Values(out vals2);

                for (int i = 0; i < numVals; i++)
                {
                    Assert.AreEqual(vals[i], vals2[i]);
                    Assert.AreEqual(missing, vals2[i]);
                }

                missing          = 9898;
                msg.MissingValue = missing;
                msg.Values(out vals);

                for (int i = 0; i < numVals; i++)
                {
                    Assert.AreEqual(missing, vals[i]);
                }
            }
        }
Exemple #18
0
        public void TestCanConvertToDegress()
        {
            using (GribFile file = new GribFile(Settings.REDUCED_LATLON_GRB2)) {
                var msg = file.First();

                // true
                //  Assert.IsTrue(msg["latitudeOfFirstGridPointInDegrees"].CanConvertToDegrees);
                Assert.IsTrue(msg["latitudeOfFirstGridPoint"].CanConvertToDegrees);
                Assert.IsTrue(msg["longitudeOfFirstGridPointInDegrees"].CanConvertToDegrees);
                Assert.IsTrue(msg["longitudeOfFirstGridPoint"].CanConvertToDegrees);
                Assert.IsTrue(msg["latitudeOfLastGridPointInDegrees"].CanConvertToDegrees);
                Assert.IsTrue(msg["latitudeOfLastGridPoint"].CanConvertToDegrees);
                Assert.IsTrue(msg["jDirectionIncrement"].CanConvertToDegrees);
                Assert.IsTrue(msg["iDirectionIncrement"].CanConvertToDegrees);

                // false
                Assert.IsFalse(msg["numberOfPointsAlongAParallel"].CanConvertToDegrees);
                Assert.IsFalse(msg["numberOfPointsAlongAParallelInDegrees"].CanConvertToDegrees);
                Assert.IsFalse(msg["numberOfPointsAlongAMeridian"].CanConvertToDegrees);
                Assert.IsFalse(msg["numberOfPointsAlongAMeridianInDegrees"].CanConvertToDegrees);
                Assert.IsFalse(msg["packingType"].CanConvertToDegrees);
            }
        }
Exemple #19
0
		public void TestOpenPng()
		{
			using (GribFile file = new GribFile(Settings.PNG_COMPRESSION)) {
				Assert.IsTrue(file.MessageCount > 0);

				var msg = file.First();

				try {
					Assert.IsTrue(msg["packingType"].AsString().ToLower().EndsWith("_png"));
					Assert.IsTrue(msg.ValuesCount > 0);
					Assert.IsTrue(msg.GeoSpatialValues.Any());
					int i = 0;
					foreach (var v in msg.GeoSpatialValues) {
						Assert.AreNotEqual(Double.NaN, v.Value);
						if (i++ > 1000) break;
					}
				} catch (GribApiException e) {
					Console.WriteLine(e.Message);
					Console.WriteLine(msg.ShortName);
					Console.WriteLine(msg.ToString());
					Assert.IsTrue(false);
				}
			}
		}
Exemple #20
0
        public void TestCanConvertToDegress ()
        {
            using (GribFile file = new GribFile(Settings.REDUCED_LATLON_GRB2))
            {
                var msg = file.First();

                // true
                Assert.IsTrue(msg["latitudeOfFirstGridPointInDegrees"].CanConvertToDegrees);
                Assert.IsTrue(msg["latitudeOfFirstGridPoint"].CanConvertToDegrees);
                Assert.IsTrue(msg["longitudeOfFirstGridPointInDegrees"].CanConvertToDegrees);
                Assert.IsTrue(msg["longitudeOfFirstGridPoint"].CanConvertToDegrees);
                Assert.IsTrue(msg["latitudeOfLastGridPointInDegrees"].CanConvertToDegrees);
                Assert.IsTrue(msg["latitudeOfLastGridPoint"].CanConvertToDegrees);
                Assert.IsTrue(msg["jDirectionIncrement"].CanConvertToDegrees);
                Assert.IsTrue(msg["iDirectionIncrement"].CanConvertToDegrees);

                // false
                Assert.IsFalse(msg["numberOfPointsAlongAParallel"].CanConvertToDegrees);
                Assert.IsFalse(msg["numberOfPointsAlongAParallelInDegrees"].CanConvertToDegrees);
                Assert.IsFalse(msg["numberOfPointsAlongAMeridian"].CanConvertToDegrees);
                Assert.IsFalse(msg["numberOfPointsAlongAMeridianInDegrees"].CanConvertToDegrees);
                Assert.IsFalse(msg["packingType"].CanConvertToDegrees);
            }
        }
Exemple #21
0
        public void TestCompression(string grid)
        {
            if (File.Exists(Settings.OUT_GRIB))
            {
                File.Delete(Settings.OUT_GRIB);
            }

            int    count = 0;
            double val   = Double.NaN;

            Dictionary <int, GeoSpatialValue> orig = new Dictionary <int, GeoSpatialValue>();

            using (var readFile = new GribFile(Settings.REDUCED_LATLON_GRB2))
            {
                var msg = readFile.First();
                count = msg.ValuesCount;
                val   = msg["latitudeOfFirstGridPoint"].AsDouble();
                Assert.AreNotEqual(val, Double.NaN);
                Assert.AreNotEqual(msg["packingType"].AsString(), grid);

                {
                    for (int j = 0; j < 50; j++)
                    {
                        int k = 0;

                        do
                        {
                            // over 200k values, so only pick from a subset
                            k = GetRandomNumber(0, (count) / 20);
                        }while (orig.ContainsKey(k));

                        orig.Add(k, new GeoSpatialValue());
                    }

                    int x = 0;
                    int y = 0;
                    foreach (var gsv in msg.GeoSpatialValues)
                    {
                        if (orig.ContainsKey(x))
                        {
                            orig[x] = gsv;
                            y++;
                            if (y == orig.Count)
                            {
                                break;
                            }
                        }
                        x++;
                    }

                    Assert.IsTrue(y == orig.Count);
                    Assert.IsTrue(x > 0);
                }

                msg["packingType"].AsString(grid);
                Assert.AreEqual(msg["packingType"].AsString(), grid);
                Assert.AreEqual(count, msg.ValuesCount);
                Assert.AreEqual(val, msg["latitudeOfFirstGridPoint"].AsDouble());
                GribFile.Write(Settings.OUT_GRIB, msg);

                var newGsv = msg.GeoSpatialValues.ToArray();
                Assert.IsTrue(newGsv.Any());

                foreach (var kvp in orig)
                {
                    var nv = newGsv[kvp.Key];
                    Assert.AreEqual(kvp.Value.Value, nv.Value, 0.01);
                }
            }

            using (var readFile = new GribFile(Settings.OUT_GRIB))
            {
                var msg = readFile.First();
                Assert.AreEqual(count, msg.ValuesCount);
                Assert.AreEqual(val, msg["latitudeOfFirstGridPoint"].AsDouble());
                Assert.AreEqual(msg["packingType"].AsString(), grid);

                var newGsv = msg.GeoSpatialValues.ToArray();
                Assert.IsTrue(newGsv.Any());

                foreach (var kvp in orig)
                {
                    var nv = newGsv[kvp.Key];
                    Assert.AreEqual(kvp.Value.Value, nv.Value, 0.01);
                }
            }
        }
Exemple #22
0
		public void TestPrecision()
		{
			var file = new GribFile(Settings.REG_GAUSSIAN_SURFACE_GRB2);
			var msg = file.First();
			Assert.AreEqual(msg["bitsPerValue"].AsInt(), 14);
			msg.DecimalPrecision = 4;
			Assert.AreEqual(msg["bitsPerValue"].AsInt(), 20);
		}
Exemple #23
0
		public void TestEnumDisposal ()
		{
			using (var file1 = new GribFile(Settings.COMPLEX_GRID))
			using (var file2 = new GribFile(Settings.TIME)) {
				var msg1 = file1.First();
				var msg2 = file2.First();

				var msgEnumerator1 = msg1.GetEnumerator();
				var msgEnumerator2 = msg2.GetEnumerator();
				int i = 0;
				while (msgEnumerator1.MoveNext() && msgEnumerator2.MoveNext()) {
					i++;
					Assert.IsNotEmpty(msgEnumerator1.Current.Key);
					Assert.IsNotEmpty(msgEnumerator2.Current.Key);
				}
				Assert.IsTrue(i > 3);
			}
		}
Exemple #24
0
        public void TestGetNativeType()
        {
            using (GribFile file = new GribFile(Settings.REG_LATLON_GRB1))
            {
                var msg = file.First();
                Assert.AreEqual(msg["packingType"].NativeType, GribValueType.String);
                Assert.AreEqual(msg["longitudeOfFirstGridPointInDegrees"].NativeType, GribValueType.Double);
                Assert.AreEqual(msg["numberOfPointsAlongAParallel"].NativeType, GribValueType.Int);
                Assert.AreEqual(msg["values"].NativeType, GribValueType.DoubleArray);

                // TODO: test other types
            }
        }
Exemple #25
0
        public void TestGetGrib2 ()
        {
            double delta = 0.1d;

            using (GribFile file = new GribFile(Settings.REDUCED_LATLON_GRB2))
            {
                var msg = file.First();

                // "InDegrees" is a magic token that converts coordinate double values to degrees
                // explicit degree conversion via key name
                double latitudeOfFirstGridPointInDegrees = msg["latitudeOfFirstGridPoint"].AsDouble();
                Assert.AreEqual(latitudeOfFirstGridPointInDegrees, 90, delta);

                // degree conversion via accessor
                double longitudeOfFirstGridPointInDegrees = msg["longitudeOfFirstGridPoint"].AsDouble(/* inDegrees == true */);
                Assert.AreEqual(longitudeOfFirstGridPointInDegrees, 0, delta);

                // degree conversion via accessor
                double latitudeOfLastGridPointInDegrees = msg["latitudeOfLastGridPoint"].AsDouble(/* inDegrees == true */);
                Assert.AreEqual(latitudeOfLastGridPointInDegrees, -90, delta);

                // degree conversion via accessor
                double longitudeOfLastGridPointInDegrees = msg["longitudeOfLastGridPoint"].AsDouble(/* inDegrees == true */);
                Assert.AreEqual(longitudeOfLastGridPointInDegrees, 360, .5);

                // degree conversion via accessor
                double jDirectionIncrementInDegrees = msg["jDirectionIncrement"].AsDouble(/* inDegrees == true */);
                Assert.AreEqual(jDirectionIncrementInDegrees, 0.36, delta);

                // degree conversion via accessor
                double iDirectionIncrementInDegrees = msg["iDirectionIncrement"].AsDouble(/* inDegrees == true */);
                Assert.AreEqual(iDirectionIncrementInDegrees, -1.0E+100, delta);

                int numberOfPointsAlongAParallel = msg["numberOfPointsAlongAParallel"].AsInt();
                Assert.AreEqual(numberOfPointsAlongAParallel, -1);

                int numberOfPointsAlongAMeridian = msg["numberOfPointsAlongAMeridian"].AsInt();
                Assert.AreEqual(numberOfPointsAlongAMeridian, 501);

                string packingType = msg["packingType"].AsString();
                Assert.AreEqual("grid_simple", packingType);             
            }
        }
Exemple #26
0
        public void TestCompression (string grid)
        {
            if (File.Exists(Settings.OUT_GRIB))
            {
                File.Delete(Settings.OUT_GRIB);
            }

            int count = 0;
            double val = Double.NaN;

            Dictionary<int, GeoSpatialValue> orig = new Dictionary<int, GeoSpatialValue>();

            using (var readFile = new GribFile(Settings.REDUCED_LATLON_GRB2))
            {
                var msg = readFile.First();
                count = msg.ValuesCount;
                val = msg["latitudeOfFirstGridPoint"].AsDouble();
                Assert.AreNotEqual(val, Double.NaN);
                Assert.AreNotEqual(msg["packingType"].AsString(), grid);

                {
                    for (int j = 0; j < 50; j++)
                    {
                        int k = 0;

                        do
                        {
                            // over 200k values, so only pick from a subset
                            k = GetRandomNumber(0, (count) / 20);
                        }
                        while (orig.ContainsKey(k));

                        orig.Add(k, new GeoSpatialValue());
                    }

                    int x = 0;
                    int y = 0;
                    foreach(var gsv in msg.GeoSpatialValues)
                    {
                        if (orig.ContainsKey(x))
                        {
                            orig[x] = gsv;
                            y++;
                            if (y == orig.Count) break;
                        }
                        x++;
                    }

                    Assert.IsTrue(y == orig.Count);
                    Assert.IsTrue(x > 0);
                }

                msg["packingType"].AsString(grid);
                Assert.AreEqual(msg["packingType"].AsString(), grid);
                Assert.AreEqual(count, msg.ValuesCount);
                Assert.AreEqual(val, msg["latitudeOfFirstGridPoint"].AsDouble());
                GribFile.Write(Settings.OUT_GRIB, msg);

                var newGsv = msg.GeoSpatialValues.ToArray();
                Assert.IsTrue(newGsv.Any());

                foreach (var kvp in orig)
                {
                    var nv = newGsv[kvp.Key];
                    Assert.AreEqual(kvp.Value.Value, nv.Value, 0.01);
                }
            }

            using (var readFile = new GribFile(Settings.OUT_GRIB))
            {
                var msg = readFile.First();
                Assert.AreEqual(count, msg.ValuesCount);
                Assert.AreEqual(val, msg["latitudeOfFirstGridPoint"].AsDouble());
                Assert.AreEqual(msg["packingType"].AsString(), grid);

                var newGsv = msg.GeoSpatialValues.ToArray();
                Assert.IsTrue(newGsv.Any());

                foreach (var kvp in orig)
                {
                    var nv = newGsv[kvp.Key];
                    Assert.AreEqual(kvp.Value.Value, nv.Value, 0.01);
                }
            }
        }