MARCS Common Blocks

Identifying Fortran common blocks used throughout the MARCS model atmosphere package. The goal is to have a list of common blocks with an index of each routine they appear in.


In [1]:
import fileinput as fi

I have already run grep from the command line using

grep -i -n "common" *.f > marcs_common_blocks.txt

The option -i indicates that the search should be case insensitive and -n returns the line number on which the search phrase is used. I've also piped the output to a file called marcs_common_blocks.txt for easy manipulation. All MARCS files have the .f Fortran extension, so all instances should be returned using this search.

Now, let's look at the file structure.


In [2]:
!head -n 5 marcs_common_blocks.txt


algebn.f:50:      COMMON/SPACE1/A1,A2,A3,D1,D2,B1,B2,B3,C,Q1,O1,
archiv.f:23:C        COMMONS SHARED BY MAIN PROGRAM
archiv.f:25:      COMMON /TAUC/TAU(NDP),DTAULN(NDP),JTAU
archiv.f:26:      COMMON/STATEC/PRAD(NDP),PTURB(NDP),P(NDP),GG(NDP),ZZ(NDP),DD(NDP),
archiv.f:29:      COMMON /ROSSC/XKAPR(NDP),CROSS(NDP)

The basic structure is filename.f:##: followed by the contents on the line. Since older Fortran required users to start in the 7th column, there is ample whitespace between the file information and the line content. The only exception is when a line is commented out.

We can read the data in and separate it using the colon, :, as a delimeter.


In [3]:
marcs_common_blocks = [line.split(':') for line in fi.input('marcs_common_blocks.txt')]

Check to make sure we've acheived what we set out to do.


In [4]:
marcs_common_blocks[0]


Out[4]:
['algebn.f', '50', '      COMMON/SPACE1/A1,A2,A3,D1,D2,B1,B2,B3,C,Q1,O1,\n']

Now we need to figure out whether we can easily access common block names. They are always surrounded by / /, but we need to be careful to avoid irregular spacings. It is therefore advantageous to trim all whitespace in the third column before populating the list. We also want to strip new line characters and convert everything to lower case. However, let us also avoid commented lines and focus only on active common blocks. Comments are indicated by either c, !, or *.


In [5]:
common_block_names = [entry[2].rstrip('\n').lower().replace(' ', '') 
                      for entry in marcs_common_blocks if entry[2][0].lower() not in ['c', '!', '*']]

With commented entries removed, all common blocks can be identified by their initial c character. This will ensure that all unwanted entries that spuriously ended up in the list are removed. Then, we extract common block names by looking what is between the / /.


In [6]:
common_block_names = [entry[entry.find('/') + 1:entry.rfind('/')] for entry in common_block_names 
                      if entry[0].lower() == 'c']

Check whether we've isolated common block names.


In [7]:
common_block_names[0], common_block_names[50], common_block_names[-1]


Out[7]:
('space1', 'density', 'ldopac')

Remove duplicates from the list.


In [8]:
common_block_names = list(set(common_block_names))

Here's a full listing.


In [9]:
common_block_names.sort()
common_block_names


Out[9]:
['auxabund',
 'auxabund/absc,abti,abv,abmn,abco/auxabund',
 'babsma',
 'bplc',
 'c030617',
 'ca1',
 'ca1/delt,tbot,idel,isvit,iteta,kvadt,/ca1',
 'ca2',
 'ca3',
 'ca4',
 'ca5',
 'ca5/ab,fakt,pe,t,xla,xla3,ro,sumabs,sumsca,viktr,iset,nlb/ca5',
 'cangle',
 'carc1',
 'carc2',
 'carc2c',
 'carc3',
 'carc4',
 'carc4/prov,nprova,nprovs,nprov/carc4',
 'catfil',
 'ccontmolc',
 'cemu',
 'cfil',
 'cfil/ireset,islask,ireat/cfil',
 'cg',
 'cg/grav/cteff',
 'char',
 'ci1',
 'ci3',
 'ci4',
 'ci5',
 'ci5/abund,anjon,h,part,dxi,f1,f2,f3,f4,f5,xkhm,xmh,xmy/ci5',
 'ci6',
 'ci7',
 'ci8',
 'ci9',
 'cit',
 'cline1',
 'cline2',
 'cline3',
 'cline4',
 'cline4/iline/cline4',
 'clockmess',
 'cmetbl',
 'cmol1',
 'cmol2',
 'comfh1',
 'coutr',
 'coutr/nto,ntpo/coutr',
 'cpf',
 'cphydro',
 'cpoly',
 'cresume',
 'cros',
 'cros/wros/cros',
 'cspher',
 'cspher/ncore,diflog,radius,rr(ndp)/ctaum',
 'cstyr',
 'cstyr/mihal,noconv/ctaum',
 'cstyr/mihal,noconv/cxmax/xmax/ctaum',
 'cstyr/mihal,noconv/debug',
 'csurf',
 'cteff',
 'cteff/teff,flux/cg',
 'ctempcorr',
 'ctevolv',
 'ctran',
 'ctranprnt',
 'cvaagl',
 'cvaagl/nlb,xlb,w/cvaagl',
 'cxlset',
 'cxlset/nset,nl,xl/cxlset',
 'cxmax',
 'density',
 'densty',
 'derivross',
 'eqeosdbg',
 'exactross',
 'files',
 'filetsuji',
 'fullequilibrium',
 'funco',
 'geom',
 'hlicnt',
 'ldopac',
 'ldopac/ales,bles/ldopac',
 'macroturb',
 'masse',
 'mixc',
 'mixc/palfa,pbeta,pny,py/cstyr',
 'mixc/palfa,pbeta,pny,py/cvfix',
 'momeq',
 'nature',
 'newmo',
 'odfcd',
 'odfwav/nlbod,odxlb,odw/odfwav',
 'omstart',
 'orderedpress',
 'osdata',
 'osfil',
 'osopac',
 'osopacnt',
 'osuse',
 'planck',
 'plez',
 'rabell',
 'refabundances',
 'rhoc',
 'rhotsu',
 'rossc',
 'rossc/ross(ndp),cdumm(ndp)/rhoc',
 'rossc/ross(ndp),cross(ndp)/rhoc',
 'rossoption',
 'savetran',
 'space1',
 'space2',
 'special',
 'specnew9',
 'statec',
 'tauc',
 'tio',
 'transsave',
 'trdbug',
 'tsuji',
 'turbul',
 'underfl',
 'utput',
 'utput/iread,iwrit/utput',
 'vers35',
 'xands',
 'zzzz']

Thre are clearly some issues related to programming styles. Most repeated occurrences are the result of the user "closing" the common block or by including multiple common blocks on a single line. Let's remove those with some brute force tactics.


In [10]:
second_round_names = [entry[entry.rfind('/') + 1:] for entry in common_block_names if entry.rfind('/') != -1]

In [11]:
second_round_names


Out[11]:
['auxabund',
 'ca1',
 'ca5',
 'carc4',
 'cfil',
 'cteff',
 'ci5',
 'cline4',
 'coutr',
 'cros',
 'ctaum',
 'ctaum',
 'ctaum',
 'debug',
 'cg',
 'cvaagl',
 'cxlset',
 'ldopac',
 'cstyr',
 'cvfix',
 'odfwav',
 'rhoc',
 'rhoc',
 'utput']

Only one entry has three common block names, but luckily the third name is already indexed, so we can move on. Get only the first common block name from the original list.


In [12]:
first_round_names = [entry for entry in common_block_names if entry.rfind('/') == -1]

Combine the two lists and remove duplicate entries.


In [13]:
common_block_names = list(set(first_round_names + second_round_names))

In [14]:
common_block_names.sort()

Now we are in a position to create a table of contents for our common blocks. It may be best for visualization if we write it in both plain text and markdown.

First, a test to get a proper formatting.


In [15]:
key = common_block_names[0]
print key.upper()
for entry in marcs_common_blocks:
    if entry[2].lower().find(key) != -1:
        print "\t {:16s} on line: {:4s}".format(entry[0], entry[1])


AUXABUND
	 archiv.f         on line: 71  
	 eqmol_pe.f       on line: 102 
	 eqmol_pe_lu.f    on line: 102 
	 injon.f          on line: 108 

That seems to be quite reasonable. Now for all keys,


In [16]:
for key in common_block_names:
    print key.upper()
    for entry in marcs_common_blocks:
        if entry[2].lower().find(key) != -1:
            print "\t {:16s} on line: {:4s}".format(entry[0], entry[1])
        else:
            pass


AUXABUND
	 archiv.f         on line: 71  
	 eqmol_pe.f       on line: 102 
	 eqmol_pe_lu.f    on line: 102 
	 injon.f          on line: 108 
BABSMA
	 oldsta.f         on line: 24  
	 oldsta_test.f    on line: 20  
BPLC
	 bpl.f            on line: 4   
C030617
	 archiv.f         on line: 97  
	 detabs.f         on line: 119 
	 osabsko.f        on line: 65  
CA1
	 inabs.f          on line: 96  
	 osinit.f         on line: 21  
	 tabs.f           on line: 20  
	 tabs.f           on line: 36  
CA2
	 detabs.f         on line: 117 
	 inabs.f          on line: 99  
	 osabsko.f        on line: 31  
	 osabsko.f        on line: 49  
	 tabs.f           on line: 39  
CA3
	 inabs.f          on line: 100 
	 osabsko.f        on line: 31  
	 osabsko.f        on line: 50  
CA4
	 osabsko.f        on line: 32  
	 osabsko.f        on line: 51  
	 tabs.f           on line: 40  
CA5
	 detabs.f         on line: 56  
	 detabs.f         on line: 90  
	 osabsko.f        on line: 52  
	 tryck.f          on line: 49  
CANGLE
	 osmainb.f        on line: 17  
CARC1
	 archiv.f         on line: 38  
	 marcs35sph.f     on line: 60  
	 oslistmo.f       on line: 30  
	 osmainb.f        on line: 20  
	 ossolve.f        on line: 125 
	 startm.f         on line: 34  
CARC2
	 archiv.f         on line: 48  
	 archiv.f         on line: 50  
	 marcs35sph.f     on line: 89  
	 ossolve.f        on line: 127 
	 ossolve.f        on line: 128 
CARC2C
	 archiv.f         on line: 50  
	 ossolve.f        on line: 128 
CARC3
	 archiv.f         on line: 58  
	 jon.f            on line: 54  
	 osabsko.f        on line: 58  
	 osopac_35.f      on line: 48  
	 takemolec.f      on line: 32  
	 takemolec.f      on line: 111 
CARC4
	 archiv.f         on line: 64  
	 detabs.f         on line: 97  
	 inabs.f          on line: 93  
	 osabsko.f        on line: 59  
CATFIL
	 osdata_35.f      on line: 11  
	 readabund.f      on line: 13  
CCONTMOLC
	 archiv.f         on line: 94  
	 osopac_35.f      on line: 103 
CEMU
	 archiv.f         on line: 100 
	 eqmol_pe.f       on line: 122 
	 eqmol_pe_lu.f    on line: 122 
CFIL
	 archiv.f         on line: 40  
	 inabs.f          on line: 101 
	 osabsko.f        on line: 31  
	 osabsko.f        on line: 55  
	 osinit.f         on line: 25  
CG
	 archiv.f         on line: 32  
	 momeqcheck.f     on line: 6   
	 osmainb.f        on line: 14  
	 ossolve.f        on line: 105 
	 scale.f          on line: 6   
	 scale.f          on line: 19  
	 startm.f         on line: 27  
	 tryck.f          on line: 39  
	 tryck.f          on line: 218 
CHAR
	 archiv.f         on line: 65  
	 detabs.f         on line: 114 
	 inabs.f          on line: 94  
	 osmainb.f        on line: 23  
	 ossolve.f        on line: 106 
	 scale.f          on line: 20  
	 startm.f         on line: 28  
CI1
	 archiv.f         on line: 55  
	 eqmol_pe.f       on line: 76  
	 eqmol_pe_lu.f    on line: 76  
	 injon.f          on line: 90  
	 injon.f          on line: 385 
	 jon.f            on line: 28  
	 jon.f            on line: 42  
	 takemolec.f      on line: 33  
CI3
	 injon.f          on line: 93  
	 modjon.f         on line: 28  
	 qtrav.f          on line: 12  
	 qtrav.f          on line: 16  
CI4
	 archiv.f         on line: 57  
	 injon.f          on line: 95  
	 jon.f            on line: 28  
	 jon.f            on line: 44  
	 marcs35sph.f     on line: 57  
	 modjon.f         on line: 29  
	 osabsko.f        on line: 61  
	 osopac_35.f      on line: 45  
CI5
	 archiv.f         on line: 53  
	 detabs.f         on line: 37  
	 detabs.f         on line: 85  
	 die_pe.f         on line: 49  
	 die_pe_lu.f      on line: 47  
	 eqmol_pe.f       on line: 92  
	 eqmol_pe_lu.f    on line: 92  
	 injon.f          on line: 96  
	 jon.f            on line: 28  
	 jon.f            on line: 45  
	 molecpartf.f     on line: 30  
	 osmet_35.f       on line: 44  
	 osopac_35.f      on line: 46  
	 takemolec.f      on line: 53  
CI6
	 injon.f          on line: 98  
	 jon.f            on line: 28  
	 jon.f            on line: 47  
	 modjon.f         on line: 30  
CI7
	 jon.f            on line: 48  
	 qtrav.f          on line: 18  
CI8
	 jon.f            on line: 51  
	 ossolve.f        on line: 129 
	 startm.f         on line: 36  
	 tryck.f          on line: 43  
	 tryck.f          on line: 223 
CI9
	 injon.f          on line: 92  
CIT
	 marcs35sph.f     on line: 56  
	 osopac_35.f      on line: 68  
	 ossolve.f        on line: 137 
CLINE1
	 osopac_35.f      on line: 35  
	 setdis.f         on line: 13  
CLINE2
	 osopac_35.f      on line: 37  
CLINE3
	 setdis.f         on line: 15  
	 vaagl.f          on line: 18  
CLINE4
	 archiv.f         on line: 35  
	 osinit.f         on line: 53  
	 osmainb.f        on line: 22  
	 osopac_35.f      on line: 38  
	 ossolve.f        on line: 133 
	 setdis.f         on line: 17  
CLOCKMESS
	 marcs35sph.f     on line: 93  
	 osopac_35.f      on line: 108 
	 ossolve.f        on line: 177 
	 startm.f         on line: 39  
CMETBL
	 osmainb.f        on line: 29  
	 osopac_35.f      on line: 50  
CMOL1
	 archiv.f         on line: 61  
	 eqmol_pe.f       on line: 95  
	 eqmol_pe_lu.f    on line: 95  
	 jon.f            on line: 52  
	 osabsko.f        on line: 62  
	 osopac_35.f      on line: 44  
CMOL2
	 archiv.f         on line: 59  
	 eqmol_pe.f       on line: 98  
	 eqmol_pe_lu.f    on line: 98  
	 jon.f            on line: 53  
COMFH1
	 checkpartf.f     on line: 20  
	 die_pe.f         on line: 43  
	 die_pe_lu.f      on line: 41  
	 eqmol_pe.f       on line: 68  
	 eqmol_pe_lu.f    on line: 68  
	 funcv.f          on line: 34  
	 molecpartf.f     on line: 23  
	 takemolec.f      on line: 48  
COUTR
	 osabsko.f        on line: 56  
	 osinit.f         on line: 40  
CPF
	 marcs35sph.f     on line: 58  
	 momeqcheck.f     on line: 14  
	 osopac_35.f      on line: 41  
	 ossolve.f        on line: 108 
	 rossop.f         on line: 9   
CPHYDRO
	 jon.f            on line: 59  
CPOLY
	 osmainb.f        on line: 26  
CRESUME
	 oldsta.f         on line: 12  
	 onfrom.f         on line: 13  
CROS
	 archiv.f         on line: 29  
	 hydropacmodif.f  on line: 36  
	 momeqcheck.f     on line: 12  
	 onfrom.f         on line: 12  
	 osabsko.f        on line: 57  
	 osinit.f         on line: 33  
	 osopac_35.f      on line: 32  
	 ossolve.f        on line: 119 
	 ossolve.f        on line: 121 
	 scale.f          on line: 13  
	 scale.f          on line: 17  
	 startm.f         on line: 31  
	 tryck.f          on line: 40  
	 tryck.f          on line: 41  
	 tryck.f          on line: 219 
	 tryck.f          on line: 220 
CSPHER
	 archiv.f         on line: 43  
	 momeqcheck.f     on line: 7   
	 onfrom.f         on line: 10  
	 osmainb.f        on line: 25  
	 ossolve.f        on line: 110 
	 scale.f          on line: 16  
	 traneq.f         on line: 55  
	 tranfr.f         on line: 32  
	 transc.f         on line: 26  
	 trrays.f         on line: 22  
	 trrays_pr.f      on line: 22  
	 tryck.f          on line: 44  
CSTYR
	 archiv.f         on line: 34  
	 osmainb.f        on line: 15  
	 ossolve.f        on line: 103 
	 scale.f          on line: 22  
	 startm.f         on line: 25  
	 tausca.f         on line: 10  
	 trrays.f         on line: 23  
	 trrays_pr.f      on line: 23  
CSURF
	 ossolve.f        on line: 118 
	 tranfr.f         on line: 33  
CTAUM
	 archiv.f         on line: 43  
	 osmainb.f        on line: 15  
	 trrays.f         on line: 23  
	 trrays_pr.f      on line: 23  
CTEFF
	 archiv.f         on line: 31  
	 osmainb.f        on line: 14  
	 ossolve.f        on line: 105 
	 scale.f          on line: 6   
	 scale.f          on line: 19  
	 startm.f         on line: 27  
CTEMPCORR
	 osinit.f         on line: 64  
	 ossolve.f        on line: 183 
CTEVOLV
	 marcs35sph.f     on line: 64  
	 ossolve.f        on line: 180 
	 startm.f         on line: 42  
CTRAN
	 ossolve.f        on line: 113 
	 ossolve.f        on line: 160 
	 traneq.f         on line: 33  
	 tranfr.f         on line: 19  
	 tranfr.f         on line: 39  
	 transc.f         on line: 14  
	 trrays.f         on line: 7   
	 trrays_pr.f      on line: 7   
	 trrays_pr.f      on line: 26  
CTRANPRNT
	 ossolve.f        on line: 160 
	 tranfr.f         on line: 39  
	 trrays_pr.f      on line: 26  
CVAAGL
	 archiv.f         on line: 41  
	 hydropacmodif.f  on line: 34  
	 osinit.f         on line: 45  
	 osmet_35.f       on line: 39  
	 osmet_separate_35.f on line: 20  
	 osopac_35.f      on line: 34  
	 ossolve.f        on line: 102 
	 traneq.f         on line: 43  
	 trrays_pr.f      on line: 27  
CVFIX
	 osmainb.f        on line: 16  
	 ossolve.f        on line: 104 
	 startm.f         on line: 26  
CXLSET
	 archiv.f         on line: 42  
	 inabs.f          on line: 102 
	 kap5.f           on line: 6   
	 osinit.f         on line: 29  
	 osopac_35.f      on line: 33  
	 ossolve.f        on line: 162 
	 setdis.f         on line: 12  
CXMAX
	 osmainb.f        on line: 15  
	 osopac_35.f      on line: 39  
DEBUG
	 ossolve.f        on line: 103 
	 startm.f         on line: 25  
	 traneq.f         on line: 56  
	 tranfr.f         on line: 35  
DENSITY
	 die_pe.f         on line: 42  
	 die_pe_lu.f      on line: 40  
	 eqmol_pe.f       on line: 86  
	 eqmol_pe_lu.f    on line: 86  
	 jon.f            on line: 70  
	 molecpartf.f     on line: 28  
	 osopac_35.f      on line: 95  
DENSTY
	 osabsko.f        on line: 63  
	 osopac_35.f      on line: 49  
DERIVROSS
	 ossolve.f        on line: 121 
	 scale.f          on line: 17  
	 tryck.f          on line: 41  
	 tryck.f          on line: 220 
EQEOSDBG
	 marcs35sph.f     on line: 86  
EXACTROSS
	 archiv.f         on line: 30  
	 ossolve.f        on line: 120 
FILES
	 eqmol_pe.f       on line: 45  
	 eqmol_pe_lu.f    on line: 45  
FILETSUJI
	 eqmol_pe.f       on line: 111 
	 eqmol_pe_lu.f    on line: 111 
	 marcs35sph.f     on line: 83  
FULLEQUILIBRIUM
	 archiv.f         on line: 79  
	 detabs.f         on line: 107 
	 osopac_35.f      on line: 87  
	 takemolec.f      on line: 9   
	 takemolec.f      on line: 12  
	 takemolec.f      on line: 28  
FUNCO
	 die_pe.f         on line: 56  
	 die_pe_lu.f      on line: 54  
	 funcv.f          on line: 38  
GEOM
	 marcs35sph.f     on line: 75  
	 scale.f          on line: 15  
	 tryck.f          on line: 4   
HLICNT
	 detabs.f         on line: 81  
	 hydropacmodif.f  on line: 38  
LDOPAC
	 detabs.f         on line: 100 
	 vaagl.f          on line: 19  
MACROTURB
	 archiv.f         on line: 46  
	 osmainb.f        on line: 38  
	 ossolve.f        on line: 174 
	 tausca.f         on line: 15  
	 tausca.f         on line: 18  
MASSE
	 oslistmo.f       on line: 23  
	 osmainb.f        on line: 30  
	 ossolve.f        on line: 131 
	 scale.f          on line: 14  
MIXC
	 archiv.f         on line: 33  
	 osmainb.f        on line: 16  
	 ossolve.f        on line: 104 
	 scale.f          on line: 22  
	 startm.f         on line: 26  
MOMEQ
	 momeqcheck.f     on line: 11  
	 ossolve.f        on line: 135 
	 tryck.f          on line: 45  
	 tryck.f          on line: 222 
NATURE
	 osmainb.f        on line: 23  
	 ossolve.f        on line: 106 
	 scale.f          on line: 20  
	 startm.f         on line: 28  
NEWMO
	 marcs35sph.f     on line: 62  
	 oldsta.f         on line: 26  
	 oldsta_test.f    on line: 22  
	 osinit.f         on line: 57  
	 osmainb.f        on line: 12  
	 osopac_35.f      on line: 120 
	 ossolve.f        on line: 130 
ODFCD
	 osopac_35.f      on line: 40  
ODFWAV
	 osinit.f         on line: 50  
OMSTART
	 marcs35sph.f     on line: 66  
	 oldsta.f         on line: 22  
ORDEREDPRESS
	 detabs.f         on line: 110 
	 eqmol_pe.f       on line: 79  
	 eqmol_pe_lu.f    on line: 79  
	 hydropacmodif.f  on line: 29  
	 osopac_35.f      on line: 89  
	 takemolec.f      on line: 30  
OSDATA
	 osdata_35.f      on line: 12  
	 osopac_35.f      on line: 74  
OSFIL
	 osdata_35.f      on line: 13  
OSOPAC
	 hydropacmodif.f  on line: 31  
	 hydropacmodif.f  on line: 33  
	 osmet_35.f       on line: 38  
	 osmet_separate_35.f on line: 19  
	 osopac_35.f      on line: 12  
	 osopac_35.f      on line: 75  
	 osopac_35.f      on line: 77  
	 ossolve.f        on line: 137 
	 ossolve.f        on line: 138 
	 ossolve.f        on line: 139 
OSOPACNT
	 hydropacmodif.f  on line: 33  
	 osopac_35.f      on line: 77  
	 ossolve.f        on line: 139 
OSUSE
	 osmainb.f        on line: 28  
	 osopac_35.f      on line: 52  
PLANCK
	 bpl.f            on line: 5   
	 bpl.f            on line: 8   
	 ossolve.f        on line: 115 
	 ossolve.f        on line: 117 
	 traneq.f         on line: 38  
	 traneq.f         on line: 40  
	 tranfr.f         on line: 21  
	 tranfr.f         on line: 23  
	 transc.f         on line: 16  
	 transc.f         on line: 18  
	 trrays.f         on line: 9   
	 trrays.f         on line: 12  
	 trrays_pr.f      on line: 9   
	 trrays_pr.f      on line: 12  
PLEZ
	 eqmol_pe.f       on line: 36  
	 eqmol_pe.f       on line: 56  
	 eqmol_pe_lu.f    on line: 36  
	 eqmol_pe_lu.f    on line: 56  
	 jon.f            on line: 57  
RABELL
	 jon.f            on line: 50  
REFABUNDANCES
	 archiv.f         on line: 84  
	 eqmol_pe.f       on line: 117 
	 eqmol_pe_lu.f    on line: 117 
	 injon.f          on line: 105 
	 oslistmo.f       on line: 34  
RHOC
	 ossolve.f        on line: 119 
	 startm.f         on line: 36  
	 traneq.f         on line: 47  
	 tranfr.f         on line: 34  
	 tryck.f          on line: 43  
	 tryck.f          on line: 223 
RHOTSU
	 detabs.f         on line: 106 
	 eqmol_pe.f       on line: 112 
	 eqmol_pe_lu.f    on line: 112 
	 jon.f            on line: 67  
ROSSC
	 archiv.f         on line: 29  
	 hydropacmodif.f  on line: 36  
	 momeqcheck.f     on line: 12  
	 onfrom.f         on line: 12  
	 osopac_35.f      on line: 32  
	 ossolve.f        on line: 119 
	 scale.f          on line: 13  
	 startm.f         on line: 31  
	 traneq.f         on line: 46  
	 tranfr.f         on line: 34  
	 tryck.f          on line: 40  
	 tryck.f          on line: 219 
ROSSOPTION
	 osinit.f         on line: 60  
	 ossolve.f        on line: 168 
SAVETRAN
	 traneq.f         on line: 36  
SPACE1
	 algebn.f         on line: 50  
	 oldsta.f         on line: 10  
	 oldsta.f         on line: 121 
	 oldsta_test.f    on line: 10  
	 oldsta_test.f    on line: 85  
	 onfrom.f         on line: 8   
	 ossolve.f        on line: 150 
SPACE2
	 ossolve.f        on line: 153 
	 traneq.f         on line: 48  
	 tranfr.f         on line: 25  
	 transc.f         on line: 20  
	 trrays.f         on line: 15  
	 trrays_pr.f      on line: 15  
SPECIAL
	 marcs35sph.f     on line: 77  
	 ossolve.f        on line: 158 
	 tryck.f          on line: 47  
SPECNEW9
	 oldsta.f         on line: 25  
	 oldsta_test.f    on line: 21  
	 osinit.f         on line: 56  
	 oslistmo.f       on line: 36  
	 ossolve.f        on line: 163 
STATEC
	 archiv.f         on line: 26  
	 hydropacmodif.f  on line: 26  
	 momeqcheck.f     on line: 8   
	 newsta.f         on line: 7   
	 oldsta.f         on line: 8   
	 oldsta_test.f    on line: 8   
	 onfrom.f         on line: 7   
	 osmet_35.f       on line: 40  
	 osmet_separate_35.f on line: 21  
	 osopac_35.f      on line: 29  
	 ossolve.f        on line: 59  
	 ossolve.f        on line: 259 
	 scale.f          on line: 4   
	 scale.f          on line: 11  
	 startm.f         on line: 13  
	 tausca.f         on line: 11  
	 tryck.f          on line: 35  
	 tryck.f          on line: 215 
TAUC
	 archiv.f         on line: 25  
	 oldsta.f         on line: 27  
	 oldsta_test.f    on line: 23  
	 onfrom.f         on line: 11  
	 osopac_35.f      on line: 28  
	 ossolve.f        on line: 101 
	 scale.f          on line: 23  
	 startm.f         on line: 24  
	 tausca.f         on line: 9   
	 traneq.f         on line: 45  
	 tranfr.f         on line: 24  
	 transc.f         on line: 19  
	 trrays.f         on line: 14  
	 trrays_pr.f      on line: 14  
	 tryck.f          on line: 38  
	 tryck.f          on line: 217 
TIO
	 archiv.f         on line: 60  
	 detabs.f         on line: 37  
	 detabs.f         on line: 82  
	 hydropacmodif.f  on line: 37  
	 osabsko.f        on line: 60  
	 osinit.f         on line: 60  
	 osopac_35.f      on line: 43  
	 ossolve.f        on line: 93  
	 ossolve.f        on line: 168 
	 startm.f         on line: 17  
TRANSSAVE
	 ossolve.f        on line: 132 
	 traneq.f         on line: 44  
	 tranfr.f         on line: 36  
TRDBUG
	 traneq.f         on line: 56  
	 tranfr.f         on line: 35  
TSUJI
	 archiv.f         on line: 76  
	 detabs.f         on line: 106 
	 die_pe.f         on line: 54  
	 die_pe_lu.f      on line: 52  
	 eqmol_pe.f       on line: 107 
	 eqmol_pe.f       on line: 111 
	 eqmol_pe.f       on line: 112 
	 eqmol_pe_lu.f    on line: 107 
	 eqmol_pe_lu.f    on line: 111 
	 eqmol_pe_lu.f    on line: 112 
	 jon.f            on line: 64  
	 jon.f            on line: 67  
	 marcs35sph.f     on line: 80  
	 marcs35sph.f     on line: 83  
	 osmainb.f        on line: 33  
	 osopac_35.f      on line: 83  
	 takemolec.f      on line: 24  
TURBUL
	 archiv.f         on line: 87  
	 hydropacmodif.f  on line: 35  
	 osmainb.f        on line: 35  
	 osopac_35.f      on line: 105 
	 readabund.f      on line: 15  
UNDERFL
	 traneq.f         on line: 41  
	 trrays.f         on line: 13  
	 trrays_pr.f      on line: 13  
UTPUT
	 detabs.f         on line: 93  
	 dumin.f          on line: 7   
	 inabs.f          on line: 95  
	 initjn.f         on line: 4   
	 injon.f          on line: 99  
	 jon.f            on line: 49  
	 osabsko.f        on line: 48  
	 osinit.f         on line: 36  
	 oslistmo.f       on line: 22  
	 osmainb.f        on line: 13  
	 qas.f            on line: 18  
	 setdis.f         on line: 16  
	 tabs.f           on line: 35  
	 vaagl.f          on line: 17  
VERS35
	 marcs35sph.f     on line: 74  
	 osinit.f         on line: 62  
	 osopacr.f        on line: 7   
XANDS
	 marcs35sph.f     on line: 95  
	 osopac_35.f      on line: 137 
ZZZZ
	 eqmol_pe.f       on line: 113 
	 eqmol_pe_lu.f    on line: 113 
	 injon.f          on line: 109 

That clearly works, so let's output that information to a plain text file.


In [17]:
plaint = open('common_block_index.txt', 'w')
for key in common_block_names:
    plaint.write(key.upper() + '\n')
    for entry in marcs_common_blocks:
        if entry[2].lower().find(key) != -1:
            plaint.write("\t {:30s} on line: {:4s} \n".format(entry[0], entry[1]))
        else:
            pass
    plaint.write('\n')
plaint.close()

And in markdown for easy reading online.


In [18]:
markd = open('common_block_index.md', 'w')
for key in common_block_names:
    markd.write('## ' + key.upper() + '\n')
    for entry in marcs_common_blocks:
        if entry[2].lower().find(key) != -1:
            markd.write("\t {:30s} on line: {:4s} \n".format(entry[0], entry[1]))
        else:
            pass
    markd.write('\n')
markd.close()