NOAA-ORR-ERD / OilLibrary

The NOAA library of oils and their properties.
Other
11 stars 17 forks source link

Wrong units in OilLibNorway #6

Closed knutfrode closed 7 years ago

knutfrode commented 7 years ago

In OilLibNorway the units of fraction and percent seems to be mixed for some of the columns. Thus the following columns should be multiplied by 100: asphaltenes, wax_content, DensityN-weathering, Dvis_Weathering, CutN_Fraction The columns of DVisN_kg_ms (except DVis1_kg_ms which seems to be correct) should be divided by 100.

This can all be corrected by the following Python script:

#!/usr/bin/env python

mult100 = [12, 13, 29, 32, 35, 59, 62, 65, 68, 71, 74, 77, 80,
           83, 86, 89, 92, 95, 98, 101, 104, 107, 110, 113, 116]
div100 = [57, 60, 63, 66, 69]

outfile = open('OilLibNorway_corrected', 'w')

for line in open('OilLibNorway').readlines():
    lineparts_read = line.rstrip().split('\t')
    lineparts = ['']*159
    lineparts[0:len(lineparts_read)] = lineparts_read
    for i, part in enumerate(lineparts):
        if i+1 in mult100:
            try:
                lineparts[i] = str(float(lineparts[i])*100.)
            except:
                pass
        if i+1 in div100:
            try:
                lineparts[i] = str(float(lineparts[i])/100.)
            except:
                pass
    outfile.write('\t'.join(lineparts) + '\n')

outfile.close()

After this cleaning, the oils are no longer rejected due to "heavy SA components" (#1), and the evaporation calculations become realistic.

ChrisBarker-NOAA commented 7 years ago

@JamesMakela-NOAA -- has this been fixed yet?

If not, then yes, a PR would be great.

JamesMakela-NOAA commented 7 years ago

@ChrisBarker-NOAA, @knutfrode: yes, this has been fixed as of commit ca0d351. And all of the Norway MET oil records are being imported without failure.

ChrisBarker-NOAA commented 7 years ago

Thanks James -- let's close this then.