0

I have a number of data files that all look the same. I would like to read them in using numpy or python. The file look like:

<?xml version="1.0" encoding="utf-8"?>
    <LONGLINE_60>
        <row YY="1950"  MM="   6"   LAT5="00N"  LON5="140E" HHOOKS="         1952.00"   ALB_C="           0.000"    ALB_N="               0"    YFT_C="         121.627"    YFT_N="            4796"    BET_C="          13.320"    BET_N="             429"    MLS_C="           0.000"    MLS_N="               0"    BLM_C="           0.000"    BLM_N="               0"    BUM_C="          62.717"    BUM_N="            1073"    SWO_C="           0.000"    SWO_N="               0"    OTH_C="           0.000"    OTH_N="               0"/>
        <row YY="1950"  MM="   6"   LAT5="00N"  LON5="145E" HHOOKS="         1359.00"   ALB_C="           0.000"    ALB_N="               0"    YFT_C="          94.720"    YFT_N="            3735"    BET_C="          13.507"    BET_N="             435"    MLS_C="           0.000"    MLS_N="               0"    BLM_C="           0.000"    BLM_N="               0"    BUM_C="          44.422"    BUM_N="             760"    SWO_C="           0.000"    SWO_N="               0"    OTH_C="           0.000"    OTH_N="               0"/>
        <row YY="1950"  MM="   6"   LAT5="05N"  LON5="140E" HHOOKS="            0.00"   ALB_C="           0.000"    ALB_N="               0"    YFT_C="           0.000"    YFT_N="               0"    BET_C="           0.000"    BET_N="               0"    MLS_C="           0.000"    MLS_N="               0"    BLM_C="           0.000"    BLM_N="               0"    BUM_C="           0.000"    BUM_N="               0"    SWO_C="           0.000"    SWO_N="               0"    OTH_C="           0.000"    OTH_N="               0"/>
    </LONGLINE_60>

The "row" designation indicates a single line of data. I would like to pull out the values and store them in a numpy array for plotting, for example read YY="1950" as the value 1950 and so forth. The latitudes and longitudes will be tricky. I have a lot of these files and the are about 100,000 rows each. Any help would be appreciated.

Mikej
  • 21
  • 2

0 Answers0