2
Vote

Parsing of double fails for some locals

description

If the WITSML document contains floating point literals and the local settings is using "," instead of "." as decimal mark, nWitsml will fail to parse it. See http://en.wikipedia.org/wiki/Decimal_separator for more information about decimal mark.
 
Example:
 
    [TestMethod]
    public void TestGetAllCurves()
    {
        WitsmlServer server = CreateWitsmlServer();
        WitsmlWellbore wellbore = server.getOne<WitsmlWellbore>(new WitsmlQuery(), "B-1458461", "W-1458461");
        WitsmlQuery query = new WitsmlQuery();
        query.addElementConstraint("startDateTimeIndex", "2011-05-17T12:00:00+02:00");
        query.addElementConstraint("endDateTimeIndex", "2011-05-17T12:03:00+02:00");
        query.addElementConstraint("mnemonic", "TIME");
        query.addElementConstraint("mnemonic", "GS_BPOS");
        query.addElementConstraint("mnemonic", "GS_HKLD");
        WitsmlLog log = server.getOne<WitsmlLog>(query, "L-1594991-Time", wellbore);
        foreach (var curve in log.getCurves())
        {
            Console.Out.WriteLine(curve);
            IEnumerable<string> values = curve.getValues().Select(v => { return FormatValue(v); });
            Console.Out.WriteLine(string.Join(", ", values));
        }
    }

comments

boomhauer wrote Aug 24, 2011 at 5:24 PM

I'm assuming the server is returning numbers formatted in US Invarient format, is this correct? If so, you'll want to make sure your process is using invarient for parsing numerical values, but you can then use local regional formatting when displaying them.

wrote Feb 14, 2013 at 1:45 AM