Skip to content

Commit

Permalink
Merge pull request #37 from OMS-NetZero/v2_0_dev
Browse files Browse the repository at this point in the history
Rename RCP modules
  • Loading branch information
chrisroadmap authored Aug 2, 2018
2 parents e67b6bc + 1973db8 commit f16b9b5
Show file tree
Hide file tree
Showing 17 changed files with 231 additions and 184 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
89 changes: 89 additions & 0 deletions fair/RCPs/rcp26.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Convenience module for loading in RCP emissions datasets
#
# Usage:
#
# import rcp3pd
# rcp3pd.Emissions.co2

import numpy as np
import os
emissions_filename = os.path.join(
os.path.dirname(__file__), 'data/RCP3PD_EMISSIONS.csv')
forcing_filename = os.path.join(
os.path.dirname(__file__), 'data/RCP3PD_MIDYEAR_RADFORCING.csv')
aviNOx_filename = os.path.join(
os.path.dirname(__file__), 'data/aviNOx_fraction.csv')
fossilCH4_filename = os.path.join(
os.path.dirname(__file__), 'data/fossilCH4_fraction.csv')

aviNOx_frac = np.loadtxt(aviNOx_filename, skiprows=5, usecols=(1,),
delimiter=',')
fossilCH4_frac = np.loadtxt(fossilCH4_filename, skiprows=5, usecols=(1,),
delimiter=',')

class Emissions:
emissions = np.loadtxt(emissions_filename, skiprows=37, delimiter=',')
year = emissions[:,0]
co2_fossil= emissions[:,1]
co2_land = emissions[:,2]
co2 = np.sum(emissions[:,1:3],axis=1)
ch4 = emissions[:,3]
n2o = emissions[:,4]
sox = emissions[:,5]
co = emissions[:,6]
nmvoc = emissions[:,7]
nox = emissions[:,8]
bc = emissions[:,9]
oc = emissions[:,10]
nh3 = emissions[:,11]
cf4 = emissions[:,12]
c2f6 = emissions[:,13]
c6f14 = emissions[:,14]
hfc23 = emissions[:,15]
hfc32 = emissions[:,16]
hfc43_10 = emissions[:,17]
hfc125 = emissions[:,18]
hfc134a = emissions[:,19]
hfc143a = emissions[:,20]
hfc227ea = emissions[:,21]
hfc245fa = emissions[:,22]
sf6 = emissions[:,23]
cfc11 = emissions[:,24]
cfc12 = emissions[:,25]
cfc113 = emissions[:,26]
cfc114 = emissions[:,27]
cfc115 = emissions[:,28]
carb_tet = emissions[:,29]
mcf = emissions[:,30]
hcfc22 = emissions[:,31]
hcfc141b = emissions[:,32]
hcfc142b = emissions[:,33]
halon1211 = emissions[:,34]
halon1202 = emissions[:,35]
halon1301 = emissions[:,36]
halon2402 = emissions[:,37]
ch3br = emissions[:,38]
ch3cl = emissions[:,39]


class Forcing:
forcing = np.loadtxt(forcing_filename, skiprows=59, delimiter=',')
year = forcing[:,0]
total = forcing[:,1]
volcanic = forcing[:,2]
solar = forcing[:,3]
ghg = forcing[:,5]
co2 = forcing[:,8]
ch4 = forcing[:,9]
n2o = forcing[:,10]
fgas = forcing[:,11]
halo = forcing[:,12]
aero = forcing[:,41]
cloud = forcing[:,48]
strato3 = forcing[:,49]
tropo3 = forcing[:,50]
stwv = forcing[:,51]
dust = forcing[:,47]
landuse = forcing[:,52]
bcsnow = forcing[:,53]

92 changes: 4 additions & 88 deletions fair/RCPs/rcp3pd.py
Original file line number Diff line number Diff line change
@@ -1,89 +1,5 @@
# Convenience module for loading in RCP emissions datasets
#
# Usage:
#
# import rcp3pd
# rcp3pd.Emissions.co2

import numpy as np
import os
emissions_filename = os.path.join(
os.path.dirname(__file__), 'RCP3PD_EMISSIONS.csv')
forcing_filename = os.path.join(
os.path.dirname(__file__), 'RCP3PD_MIDYEAR_RADFORCING.csv')
aviNOx_filename = os.path.join(
os.path.dirname(__file__), 'aviNOx_fraction.csv')
fossilCH4_filename = os.path.join(
os.path.dirname(__file__), 'fossilCH4_fraction.csv')

aviNOx_frac = np.loadtxt(aviNOx_filename, skiprows=5, usecols=(1,),
delimiter=',')
fossilCH4_frac = np.loadtxt(fossilCH4_filename, skiprows=5, usecols=(1,),
delimiter=',')

class Emissions:
emissions = np.loadtxt(emissions_filename, skiprows=37, delimiter=',')
year = emissions[:,0]
co2_fossil= emissions[:,1]
co2_land = emissions[:,2]
co2 = np.sum(emissions[:,1:3],axis=1)
ch4 = emissions[:,3]
n2o = emissions[:,4]
sox = emissions[:,5]
co = emissions[:,6]
nmvoc = emissions[:,7]
nox = emissions[:,8]
bc = emissions[:,9]
oc = emissions[:,10]
nh3 = emissions[:,11]
cf4 = emissions[:,12]
c2f6 = emissions[:,13]
c6f14 = emissions[:,14]
hfc23 = emissions[:,15]
hfc32 = emissions[:,16]
hfc43_10 = emissions[:,17]
hfc125 = emissions[:,18]
hfc134a = emissions[:,19]
hfc143a = emissions[:,20]
hfc227ea = emissions[:,21]
hfc245fa = emissions[:,22]
sf6 = emissions[:,23]
cfc11 = emissions[:,24]
cfc12 = emissions[:,25]
cfc113 = emissions[:,26]
cfc114 = emissions[:,27]
cfc115 = emissions[:,28]
carb_tet = emissions[:,29]
mcf = emissions[:,30]
hcfc22 = emissions[:,31]
hcfc141b = emissions[:,32]
hcfc142b = emissions[:,33]
halon1211 = emissions[:,34]
halon1202 = emissions[:,35]
halon1301 = emissions[:,36]
halon2402 = emissions[:,37]
ch3br = emissions[:,38]
ch3cl = emissions[:,39]


class Forcing:
forcing = np.loadtxt(forcing_filename, skiprows=59, delimiter=',')
year = forcing[:,0]
total = forcing[:,1]
volcanic = forcing[:,2]
solar = forcing[:,3]
ghg = forcing[:,5]
co2 = forcing[:,8]
ch4 = forcing[:,9]
n2o = forcing[:,10]
fgas = forcing[:,11]
halo = forcing[:,12]
aero = forcing[:,41]
cloud = forcing[:,48]
strato3 = forcing[:,49]
tropo3 = forcing[:,50]
stwv = forcing[:,51]
dust = forcing[:,47]
landuse = forcing[:,52]
bcsnow = forcing[:,53]
import warnings
from .rcp26 import *

warnings.warn('name rcp3pd will be deprecated in FaIR 2.0. Please use rcp26.',
DeprecationWarning)
8 changes: 4 additions & 4 deletions fair/RCPs/rcp45.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
import numpy as np
import os
emissions_filename = os.path.join(
os.path.dirname(__file__), 'RCP45_EMISSIONS.csv')
os.path.dirname(__file__), 'data/RCP45_EMISSIONS.csv')
forcing_filename = os.path.join(
os.path.dirname(__file__), 'RCP45_MIDYEAR_RADFORCING.csv')
os.path.dirname(__file__), 'data/RCP45_MIDYEAR_RADFORCING.csv')
aviNOx_filename = os.path.join(
os.path.dirname(__file__), 'aviNOx_fraction.csv')
os.path.dirname(__file__), 'data/aviNOx_fraction.csv')
fossilCH4_filename = os.path.join(
os.path.dirname(__file__), 'fossilCH4_fraction.csv')
os.path.dirname(__file__), 'data/fossilCH4_fraction.csv')

aviNOx_frac = np.loadtxt(aviNOx_filename, skiprows=5, usecols=(2,),
delimiter=',')
Expand Down
92 changes: 4 additions & 88 deletions fair/RCPs/rcp6.py
Original file line number Diff line number Diff line change
@@ -1,89 +1,5 @@
# Convenience module for loading in RCP emissions datasets
#
# Usage:
#
# import rcp6
# rcp6.Emissions.co2

import numpy as np
import os
emissions_filename = os.path.join(
os.path.dirname(__file__), 'RCP6_EMISSIONS.csv')
forcing_filename = os.path.join(
os.path.dirname(__file__), 'RCP6_MIDYEAR_RADFORCING.csv')
aviNOx_filename = os.path.join(
os.path.dirname(__file__), 'aviNOx_fraction.csv')
fossilCH4_filename = os.path.join(
os.path.dirname(__file__), 'fossilCH4_fraction.csv')

aviNOx_frac = np.loadtxt(aviNOx_filename, skiprows=5, usecols=(3,),
delimiter=',')
fossilCH4_frac = np.loadtxt(fossilCH4_filename, skiprows=5, usecols=(3,),
delimiter=',')

class Emissions:
emissions = np.loadtxt(emissions_filename, skiprows=37, delimiter=',')
year = emissions[:,0]
co2_fossil= emissions[:,1]
co2_land = emissions[:,2]
co2 = np.sum(emissions[:,1:3],axis=1)
ch4 = emissions[:,3]
n2o = emissions[:,4]
sox = emissions[:,5]
co = emissions[:,6]
nmvoc = emissions[:,7]
nox = emissions[:,8]
bc = emissions[:,9]
oc = emissions[:,10]
nh3 = emissions[:,11]
cf4 = emissions[:,12]
c2f6 = emissions[:,13]
c6f14 = emissions[:,14]
hfc23 = emissions[:,15]
hfc32 = emissions[:,16]
hfc43_10 = emissions[:,17]
hfc125 = emissions[:,18]
hfc134a = emissions[:,19]
hfc143a = emissions[:,20]
hfc227ea = emissions[:,21]
hfc245fa = emissions[:,22]
sf6 = emissions[:,23]
cfc11 = emissions[:,24]
cfc12 = emissions[:,25]
cfc113 = emissions[:,26]
cfc114 = emissions[:,27]
cfc115 = emissions[:,28]
carb_tet = emissions[:,29]
mcf = emissions[:,30]
hcfc22 = emissions[:,31]
hcfc141b = emissions[:,32]
hcfc142b = emissions[:,33]
halon1211 = emissions[:,34]
halon1202 = emissions[:,35]
halon1301 = emissions[:,36]
halon2402 = emissions[:,37]
ch3br = emissions[:,38]
ch3cl = emissions[:,39]


class Forcing:
forcing = np.loadtxt(forcing_filename, skiprows=59, delimiter=',')
year = forcing[:,0]
total = forcing[:,1]
volcanic = forcing[:,2]
solar = forcing[:,3]
ghg = forcing[:,5]
co2 = forcing[:,8]
ch4 = forcing[:,9]
n2o = forcing[:,10]
fgas = forcing[:,11]
halo = forcing[:,12]
aero = forcing[:,41]
cloud = forcing[:,48]
strato3 = forcing[:,49]
tropo3 = forcing[:,50]
stwv = forcing[:,51]
dust = forcing[:,47]
landuse = forcing[:,52]
bcsnow = forcing[:,53]
import warnings
from .rcp60 import *

warnings.warn('name rcp6 will be deprecated in FaIR 2.0. Please use rcp60.',
DeprecationWarning)
89 changes: 89 additions & 0 deletions fair/RCPs/rcp60.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Convenience module for loading in RCP emissions datasets
#
# Usage:
#
# import rcp6
# rcp6.Emissions.co2

import numpy as np
import os
emissions_filename = os.path.join(
os.path.dirname(__file__), 'data/RCP6_EMISSIONS.csv')
forcing_filename = os.path.join(
os.path.dirname(__file__), 'data/RCP6_MIDYEAR_RADFORCING.csv')
aviNOx_filename = os.path.join(
os.path.dirname(__file__), 'data/aviNOx_fraction.csv')
fossilCH4_filename = os.path.join(
os.path.dirname(__file__), 'data/fossilCH4_fraction.csv')

aviNOx_frac = np.loadtxt(aviNOx_filename, skiprows=5, usecols=(3,),
delimiter=',')
fossilCH4_frac = np.loadtxt(fossilCH4_filename, skiprows=5, usecols=(3,),
delimiter=',')

class Emissions:
emissions = np.loadtxt(emissions_filename, skiprows=37, delimiter=',')
year = emissions[:,0]
co2_fossil= emissions[:,1]
co2_land = emissions[:,2]
co2 = np.sum(emissions[:,1:3],axis=1)
ch4 = emissions[:,3]
n2o = emissions[:,4]
sox = emissions[:,5]
co = emissions[:,6]
nmvoc = emissions[:,7]
nox = emissions[:,8]
bc = emissions[:,9]
oc = emissions[:,10]
nh3 = emissions[:,11]
cf4 = emissions[:,12]
c2f6 = emissions[:,13]
c6f14 = emissions[:,14]
hfc23 = emissions[:,15]
hfc32 = emissions[:,16]
hfc43_10 = emissions[:,17]
hfc125 = emissions[:,18]
hfc134a = emissions[:,19]
hfc143a = emissions[:,20]
hfc227ea = emissions[:,21]
hfc245fa = emissions[:,22]
sf6 = emissions[:,23]
cfc11 = emissions[:,24]
cfc12 = emissions[:,25]
cfc113 = emissions[:,26]
cfc114 = emissions[:,27]
cfc115 = emissions[:,28]
carb_tet = emissions[:,29]
mcf = emissions[:,30]
hcfc22 = emissions[:,31]
hcfc141b = emissions[:,32]
hcfc142b = emissions[:,33]
halon1211 = emissions[:,34]
halon1202 = emissions[:,35]
halon1301 = emissions[:,36]
halon2402 = emissions[:,37]
ch3br = emissions[:,38]
ch3cl = emissions[:,39]


class Forcing:
forcing = np.loadtxt(forcing_filename, skiprows=59, delimiter=',')
year = forcing[:,0]
total = forcing[:,1]
volcanic = forcing[:,2]
solar = forcing[:,3]
ghg = forcing[:,5]
co2 = forcing[:,8]
ch4 = forcing[:,9]
n2o = forcing[:,10]
fgas = forcing[:,11]
halo = forcing[:,12]
aero = forcing[:,41]
cloud = forcing[:,48]
strato3 = forcing[:,49]
tropo3 = forcing[:,50]
stwv = forcing[:,51]
dust = forcing[:,47]
landuse = forcing[:,52]
bcsnow = forcing[:,53]

Loading

0 comments on commit f16b9b5

Please sign in to comment.