[ncl-talk] help to read a Table in txt file?

Dennis Shea shea at ucar.edu
Mon Sep 9 15:15:56 MDT 2019


Unfortunately, the numbers [eg:CO2, Ch4, C5C8] in the leftmost column
create an issue that readAscciTable is not designed to handle.


CO2                 1686     1489     1647     1643     1703     1585
CO                    63      127       88       93      210      102
CH4                 1.94     5.96     3.36     5.07     20.8     5.82
...
C5H8               0.039     0.15    0.099     0.13     1.38     0.38

readAsciiTable wants to treat  these embedded numbers as data values.
Hence, you must explicitly extract the values.

Please read the documentation of the functions used.





On Mon, Sep 9, 2019 at 3:22 AM Karin Meier-Fleischer via ncl-talk <
ncl-talk at ucar.edu> wrote:

> Hi Adriana,
>
> have a look at the readAsciiTable function examples
> http://ncl.ucar.edu/Document/Functions/Contributed/readAsciiTable.shtml.
>
> -Karin
>
> Am 09.09.19 um 11:05 schrieb Adriana via ncl-talk:
> > Hi everyone
> > I am writing because I have the following table:
> > #
> > # SPECIE            SAVA     BORF     TEMF     DEFO     PEAT AGRI
> > #           ----------------------------------------------------
> > DM                  1000     1000     1000     1000     1000 1000
> > C                488.273  464.989  489.416  491.751  570.055 480.352
> > CO2                 1686     1489     1647     1643     1703 1585
> > CO                    63      127       88       93      210 102
> > CH4                 1.94     5.96     3.36     5.07     20.8 5.82
> > NMHC                 3.4      8.4      8.4      1.7      1.7 9.9
> > H2                   1.7     2.03     2.03     3.36     3.36 2.59
> > NOx                  3.9      0.9     1.92     2.55        1 3.11
> > N2O                  0.2     0.41     0.16      0.2      0.2 0.1
> > PM2.5               7.17     15.3     12.9      9.1      9.1 6.26
> > TPM                  8.5     17.6     17.6       13       13 12.4
> > TPC                    3     10.1     10.1     5.24     6.06 3.05
> > OC                  2.62      9.6      9.6     4.71     6.02 2.3
> > BC                  0.37      0.5      0.5     0.52     0.04 0.75
> > SO2                 0.48      1.1      1.1      0.4      0.4 0.4
> > C2H6                0.66     1.79     0.63     0.71     0.71 0.91
> > CH3OH               1.18     2.82     1.74     2.43     8.46 3.29
> > C2H5OH             0.024    0.055      0.1    0.037    0.037 0.035
> > C3H8                 0.1     0.44     0.22    0.126    0.126 0.28
> > C2H2                0.24     0.18     0.26     0.44     0.06 0.27
> > C2H4                0.82     1.42     1.17     1.06     2.57 1.46
> > C3H6                0.79     1.13     0.61     0.64     3.05 0.68
> > C5H8               0.039     0.15    0.099     0.13     1.38 0.38
> >
> >
> > and I would like to read the variables from my txt file. I mean crate
> > a variable x(species, values)
> > however I don't realize how to do it, I was trying with some different
> > examples provides in the web page, but doesn't work.
> >
> > I really appreciate any help.
> >
> > Thank you in advance.
> >
> > Adriana
> >
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190909/c486ac28/attachment.html>
-------------- next part --------------
#
# SPECIE            SAVA     BORF     TEMF     DEFO     PEAT     AGRI
#                 ----------------------------------------------------
DM                  1000     1000     1000     1000     1000     1000
C                488.273  464.989  489.416  491.751  570.055  480.352
CO2                 1686     1489     1647     1643     1703     1585
CO                    63      127       88       93      210      102
CH4                 1.94     5.96     3.36     5.07     20.8     5.82
NMHC                 3.4      8.4      8.4      1.7      1.7      9.9
H2                   1.7     2.03     2.03     3.36     3.36     2.59
NOx                  3.9      0.9     1.92     2.55        1     3.11
N2O                  0.2     0.41     0.16      0.2      0.2      0.1
PM2.5               7.17     15.3     12.9      9.1      9.1     6.26
TPM                  8.5     17.6     17.6       13       13     12.4
TPC                    3     10.1     10.1     5.24     6.06     3.05
OC                  2.62      9.6      9.6     4.71     6.02      2.3
BC                  0.37      0.5      0.5     0.52     0.04     0.75
SO2                 0.48      1.1      1.1      0.4      0.4      0.4
C2H6                0.66     1.79     0.63     0.71     0.71     0.91
CH3OH               1.18     2.82     1.74     2.43     8.46     3.29
C2H5OH             0.024    0.055      0.1    0.037    0.037    0.035
C3H8                 0.1     0.44     0.22    0.126    0.126     0.28
C2H2                0.24     0.18     0.26     0.44     0.06     0.27
C2H4                0.82     1.42     1.17     1.06     2.57     1.46
C3H6                0.79     1.13     0.61     0.64     3.05     0.68
C5H8               0.039     0.15    0.099     0.13     1.38     0.38
-------------- next part --------------
A non-text attachment was scrubbed...
Name: species.ncl
Type: application/octet-stream
Size: 893 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190909/c486ac28/attachment.obj>


More information about the ncl-talk mailing list