├── .gitignore ├── DATA ├── Goldblatt2013_archive_revised │ └── Goldblatt_TableS1.csv ├── HITRAN_DATA │ ├── CIA │ │ ├── H2-H2_2011.T_less_800K_only.cia │ │ ├── N2-H2_2011.cia │ │ ├── N2-N2_2011.0-554cm.cia │ │ ├── N2-N2_2011.1850-3000cm.cia │ │ ├── N2-N2_2011.2000-2700cm.cia │ │ └── N2-N2_2011.cia │ └── HITRAN2016 │ │ ├── Full_0-60000cm.MainIsotopesOnly │ │ └── 01_hit16.par │ │ └── ThermalOnly_0-5000cm.MainIsotopesOnly │ │ ├── 01_hit16.par │ │ ├── 02_hit16.par │ │ └── 04_hit16.par ├── MT_CKD_continuum │ ├── README │ ├── aercntnm_mt_ckd_3.2.tar │ └── cntnm.H2O_N2 │ │ ├── aer_rt_utils │ │ ├── util_OS_X_absoft.f90 │ │ ├── util_OS_X_g95.f90 │ │ ├── util_OS_X_ibm_xl.f90 │ │ ├── util_OS_X_ifort.f90 │ │ ├── util_aix.f90 │ │ ├── util_alpha.f90 │ │ ├── util_cray.f90 │ │ ├── util_dos.f90 │ │ ├── util_gfortran.f90 │ │ ├── util_hp.f90 │ │ ├── util_linux_intel.f90 │ │ ├── util_linux_pgi.f90 │ │ ├── util_sgi.f90 │ │ └── util_sun.f90 │ │ ├── build │ │ ├── README.build_instructions │ │ ├── cntnm_v3.2_OS_X_gnu_dbl.obj │ │ │ ├── cntnm_progr.o │ │ │ ├── contnm.o │ │ │ ├── lblparams.o │ │ │ ├── phys_consts.o │ │ │ └── planet_earth.o │ │ ├── lblparams.mod │ │ ├── make_cntnm │ │ ├── makefile.common │ │ ├── phys_consts.mod │ │ └── planet_consts.mod │ │ ├── cntnm_v3.2_OS_X_gnu_dbl │ │ ├── docs │ │ └── RELEASE_NOTES_cntnm │ │ └── src │ │ ├── cntnm_progr.f │ │ ├── cntnm_progr.f90 │ │ ├── contnm.f90 │ │ ├── lblparams.f90 │ │ ├── phys_consts.f90 │ │ ├── planet_earth.f90 │ │ ├── svn_ext_val.txt │ │ ├── util_OS_X_absoft.f90 │ │ ├── util_OS_X_g95.f90 │ │ ├── util_OS_X_ibm_xl.f90 │ │ ├── util_OS_X_ifort.f90 │ │ ├── util_aix.f90 │ │ ├── util_alpha.f90 │ │ ├── util_cray.f90 │ │ ├── util_dos.f90 │ │ ├── util_gfortran.f90 │ │ ├── util_hp.f90 │ │ ├── util_linux_intel.f90 │ │ ├── util_linux_pgi.f90 │ │ ├── util_sgi.f90 │ │ └── util_sun.f90 └── VPL_solar_spectrum │ ├── vpl_sunum.txt │ ├── vpl_sunum.txt.bak │ └── vpl_sunum_extended.txt ├── LICENSE ├── README.md ├── Test01.olr └── compute_olr_h2o.py ├── Test02.runaway └── compute_olr_h2o.01.100RH.py ├── Test03.sw └── compute_sw_h2o.py ├── Test04.sw_full_spectrum ├── compute_sw_h2o.py ├── merge_spectrum.py ├── output_nA1000.0_nB10000.0_dn1.00e+00.txt ├── output_nA10000.0_nB20000.0_dn1.00e+00.txt ├── output_nA20000.0_nB30000.0_dn1.00e+00.txt ├── output_nA30000.0_nB50000.0_dn1.00e+00.txt └── output_nA50000.0_nB80000.0_dn1.00e+00.txt ├── pyDISORT-master ├── README.md ├── Version ├── _disort.pyf ├── _disort.so.dSYM │ └── Contents │ │ ├── Info.plist │ │ └── Resources │ │ └── DWARF │ │ └── _disort.so ├── build │ └── lib │ │ └── disort │ │ ├── __init__.py │ │ ├── __version__.py │ │ └── _disort.so ├── doc │ ├── Makefile │ ├── README │ ├── make.bat │ └── source │ │ ├── conf.py │ │ ├── disort.rst │ │ └── index.rst ├── lib │ └── disort │ │ ├── __init__.py │ │ ├── __version__.py │ │ └── _disort.so ├── setup.py ├── src │ └── disort │ │ ├── Driver.f │ │ └── src │ │ ├── BDREF.f │ │ ├── DISORT.f │ │ ├── ErrPack.f │ │ ├── GETMOM.f │ │ ├── LINPAK.f │ │ ├── PRTFIN.f │ │ └── RDI1MACH.f └── test │ ├── rayleigh_layer_opd.txt │ ├── test_Rayleigh.py │ └── test_disort.py └── pyrads ├── Absorption_Continuum.py ├── Absorption_Continuum.pyc ├── Absorption_Continuum_MTCKD.py ├── Absorption_Continuum_MTCKD.pyc ├── Absorption_Crosssections_HITRAN2016.py ├── Absorption_Crosssections_HITRAN2016.pyc ├── Absorption_Crosssections_UV.py ├── Absorption_Crosssections_UV.pyc ├── ClimateGraphics.py ├── ClimateGraphicsMPL.py ├── ClimateGraphicsMPL.pyc ├── ClimateUtilities.py ├── ClimateUtilities.pyc ├── DummyGraphics.py ├── Get_Fluxes.py ├── Get_Fluxes.pyc ├── Get_Fluxes_pyDISORT.py ├── Get_Fluxes_pyDISORT.pyc ├── Merge_Spectral_Output.py ├── Merge_Spectral_Output.pyc ├── OpticalThickness.py ├── OpticalThickness.pyc ├── Planck.py ├── Planck.pyc ├── Scattering_Crosssections_Rayleigh.py ├── Scattering_Crosssections_Rayleigh.pyc ├── SetupGrids.py ├── SetupGrids.pyc ├── Solar_SourceFn.py ├── Solar_SourceFn.pyc ├── Thermodynamics.py ├── Thermodynamics.pyc ├── VerticalStructure.py ├── VerticalStructure.pyc ├── Write_Data.py ├── Write_Data.pyc ├── __init__.py ├── __init__.pyc ├── hitran_cia_fast.py ├── hitran_cia_fast.pyc ├── object_helpers.py ├── object_helpers.pyc ├── phys.py └── phys.pyc /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled python modules. 2 | *.pyc 3 | # Compiled fortran objects, modules and extensions 4 | *.o 5 | *.mod 6 | *.so 7 | *.so.dSYM 8 | 9 | *.DS_Store 10 | -------------------------------------------------------------------------------- /DATA/Goldblatt2013_archive_revised/Goldblatt_TableS1.csv: -------------------------------------------------------------------------------- 1 | Wavelength (micron),c Air (m2),c H2O (m2) 2 | 1.00E-02,4.76E-60,4.20E-60 3 | 1.50E-01,4.76E-60,4.20E-60 4 | 1.60E-01,4.76E-60,4.20E-60 5 | 1.70E-01,4.76E-60,4.20E-60 6 | 1.80E-01,4.76E-60,4.20E-60 7 | 1.90E-01,4.59E-60,3.80E-60 8 | 2.00E-01,4.41E-60,3.52E-60 9 | 2.10E-01,4.23E-60,3.32E-60 10 | 2.20E-01,4.08E-60,3.17E-60 11 | 2.30E-01,3.96E-60,3.06E-60 12 | 2.40E-01,3.86E-60,2.96E-60 13 | 2.50E-01,3.77E-60,2.89E-60 14 | 2.60E-01,3.70E-60,2.82E-60 15 | 2.70E-01,3.64E-60,2.77E-60 16 | 2.80E-01,3.58E-60,2.72E-60 17 | 2.90E-01,3.54E-60,2.68E-60 18 | 3.00E-01,3.50E-60,2.65E-60 19 | 3.10E-01,3.46E-60,2.61E-60 20 | 3.20E-01,3.43E-60,2.59E-60 21 | 3.30E-01,3.40E-60,2.56E-60 22 | 3.40E-01,3.38E-60,2.54E-60 23 | 3.50E-01,3.36E-60,2.52E-60 24 | 3.60E-01,3.34E-60,2.50E-60 25 | 3.70E-01,3.32E-60,2.49E-60 26 | 3.80E-01,3.31E-60,2.47E-60 27 | 3.90E-01,3.30E-60,2.46E-60 28 | 4.00E-01,3.28E-60,2.45E-60 29 | 4.10E-01,3.27E-60,2.44E-60 30 | 4.20E-01,3.26E-60,2.43E-60 31 | 4.30E-01,3.25E-60,2.42E-60 32 | 4.40E-01,3.24E-60,2.41E-60 33 | 4.50E-01,3.23E-60,2.40E-60 34 | 4.60E-01,3.22E-60,2.39E-60 35 | 4.70E-01,3.21E-60,2.38E-60 36 | 4.80E-01,3.20E-60,2.38E-60 37 | 4.90E-01,3.19E-60,2.37E-60 38 | 5.00E-01,3.18E-60,2.36E-60 39 | 5.10E-01,3.18E-60,2.36E-60 40 | 5.20E-01,3.17E-60,2.35E-60 41 | 5.30E-01,3.17E-60,2.35E-60 42 | 5.40E-01,3.16E-60,2.34E-60 43 | 5.50E-01,3.16E-60,2.34E-60 44 | 5.60E-01,3.15E-60,2.33E-60 45 | 5.70E-01,3.15E-60,2.33E-60 46 | 5.80E-01,3.15E-60,2.32E-60 47 | 5.90E-01,3.14E-60,2.32E-60 48 | 6.00E-01,3.14E-60,2.32E-60 49 | 6.10E-01,3.14E-60,2.31E-60 50 | 6.20E-01,3.13E-60,2.31E-60 51 | 6.30E-01,3.13E-60,2.31E-60 52 | 6.40E-01,3.13E-60,2.30E-60 53 | 6.50E-01,3.12E-60,2.30E-60 54 | 6.60E-01,3.12E-60,2.30E-60 55 | 6.70E-01,3.12E-60,2.29E-60 56 | 6.80E-01,3.12E-60,2.29E-60 57 | 6.90E-01,3.11E-60,2.29E-60 58 | 7.00E-01,3.11E-60,2.29E-60 59 | 7.10E-01,3.11E-60,2.28E-60 60 | 7.20E-01,3.11E-60,2.28E-60 61 | 7.30E-01,3.11E-60,2.28E-60 62 | 7.40E-01,3.10E-60,2.28E-60 63 | 7.50E-01,3.10E-60,2.27E-60 64 | 7.60E-01,3.10E-60,2.27E-60 65 | 7.70E-01,3.10E-60,2.27E-60 66 | 7.80E-01,3.10E-60,2.27E-60 67 | 7.90E-01,3.09E-60,2.27E-60 68 | 8.00E-01,3.09E-60,2.26E-60 69 | 8.10E-01,3.09E-60,2.26E-60 70 | 8.20E-01,3.09E-60,2.26E-60 71 | 8.30E-01,3.09E-60,2.26E-60 72 | 8.40E-01,3.09E-60,2.25E-60 73 | 8.50E-01,3.09E-60,2.25E-60 74 | 8.60E-01,3.09E-60,2.25E-60 75 | 8.70E-01,3.08E-60,2.25E-60 76 | 8.80E-01,3.08E-60,2.25E-60 77 | 8.90E-01,3.08E-60,2.25E-60 78 | 9.00E-01,3.08E-60,2.24E-60 79 | 9.10E-01,3.08E-60,2.24E-60 80 | 9.20E-01,3.08E-60,2.24E-60 81 | 9.30E-01,3.08E-60,2.24E-60 82 | 9.40E-01,3.08E-60,2.24E-60 83 | 9.50E-01,3.08E-60,2.23E-60 84 | 9.60E-01,3.07E-60,2.23E-60 85 | 9.70E-01,3.07E-60,2.23E-60 86 | 9.80E-01,3.07E-60,2.23E-60 87 | 9.90E-01,3.07E-60,2.23E-60 88 | 1.00E+00,3.07E-60,2.22E-60 89 | 1.10E+00,3.07E-60,2.21E-60 90 | 1.20E+00,3.06E-60,2.21E-60 91 | 1.30E+00,3.06E-60,2.21E-60 92 | 1.40E+00,3.05E-60,2.21E-60 93 | 1.50E+00,3.05E-60,2.21E-60 94 | 1.60E+00,3.05E-60,2.21E-60 95 | 1.70E+00,3.05E-60,2.21E-60 96 | 1.80E+00,3.05E-60,2.21E-60 97 | 1.90E+00,3.05E-60,2.21E-60 98 | 2.00E+00,3.05E-60,2.21E-60 99 | 3.00E+00,3.04E-60,2.21E-60 100 | 4.00E+00,3.04E-60,2.21E-60 101 | 5.00E+00,3.04E-60,2.21E-60 102 | 1.00E+01,3.04E-60,2.21E-60 -------------------------------------------------------------------------------- /DATA/MT_CKD_continuum/README: -------------------------------------------------------------------------------- 1 | 2 | 1) For path length = 0., CNTNM.OPTDPT files produce NaN's 3 | 4 | 2) WATER.COEF files are independent of path length 5 | 3) WATER.COEF files are independent of vmr 6 | 4) WATER.COEF files are independent of pressure 7 | 8 | 5) WATER.COEF files are *not* independent of T 9 | -> also doesn't scale as ~1/T, instead something that looks more complicated [?] 10 | -> foreign broadening coef (without radiation field) *is* independent of T [?] 11 | 12 | 13 | 6) when I recompile the source code without N2,CO2, etc. 14 | the WATER.COEF files don't change! 15 | -> species are only used to compute optical thickness? 16 | 17 | 18 | 7) To use an input file do: 19 | 20 | INPUT NEEDS TO BE LINE SEPARATED (p/T/dz/vmr H2O), e.g., 21 | --- 22 | 1000. 23 | 300. 24 | 0.0 25 | 0.01 26 | --- 27 | 28 | AND THEN run "./cntnm.exe < INPUT" 29 | 30 | ============== 31 | 32 | To use in my radiation code, need a wrapper that can pass in relevant T (and p?), 33 | gets coefficients from that, and then scales them to get kappa? 34 | 35 | OR: 36 | make a wrapper that converts my inputs into the right molecular amounts, i.e., 37 | path length (of total air?) and H2O VMR, and then reads from the optical depth file. 38 | 39 | ------- 40 | TO DO: 41 | test my code by computing optical depth from the WATER.COEF file, 42 | and then compare with the CNTNM.OPTDPT file. -------------------------------------------------------------------------------- /DATA/MT_CKD_continuum/aercntnm_mt_ckd_3.2.tar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielkoll/PyRADS-shortwave/9d86f7dc07bef37f832949a584f0abe2fd3b72c4/DATA/MT_CKD_continuum/aercntnm_mt_ckd_3.2.tar -------------------------------------------------------------------------------- /DATA/MT_CKD_continuum/cntnm.H2O_N2/build/README.build_instructions: -------------------------------------------------------------------------------- 1 | # $Revision: 11001 $ 2 | * Makefiles are designed for use with gmake. 3 | * From cntnm/build directory, type: gmake -f make_cntnm 4 | 5 | TARGET DESCRIPTION COMPILE EXECUTABLE NAME 6 | aixIBMdbl IBM/AIX OS using IBM fortran,double precision xlf90 7 | aixIBMsgl IBM/AIX OS using IBM fortran,single precision xlf90 8 | linuxPGIdbl Linux OS using PGI fortran,double precision pgf90 9 | linuxPGIsgl Linux OS using PGI fortran,single precision pgf90 10 | linuxGNUdbl Linux OS using GNU fortran,double precision gfortran 11 | linuxGNUsgl Linux OS using GNU fortran,single precision gfortran 12 | linuxG95dbl Linux OS using G95 fortran,double precision g95 13 | linuxG95sgl Linux OS using G95 fortran,single precision g95 14 | linuxINTELdbl Linux OS using Intel fortran,double precision ifort 15 | linuxINTELsgl Linux OS using Intel fortran,single precision ifort 16 | mingwGNUdbl Windows unix shell environment using gfortran,double precision gfortran 17 | mingwGNUsgl Windows unix shell environment using gfortran,single precision gfortran 18 | osxABSOFTdbl Mac OS_X using Absoft Pro fortran,double precision f90 19 | osxABSOFTsgl Mac OS_X using Absoft Pro fortran,singleprecision f90 20 | osxGNUdbl Mac OS_X using GNU fortran,double precision gfortran 21 | osxGNUsgl Mac OS_X using GNU fortran,singleprecision gfortran 22 | osxIBMdbl Mac OS_X using IBM XL fortran,double precision xlf90 23 | osxIBMsgl Mac OS_X using IBM XL fortran,singleprecision xlf90 24 | osxINTELdbl Mac OS_X using Intel fortran,double precision ifort 25 | osxINTELsgl Mac OS_X using Intel fortran,single precision ifort 26 | sunSUNdbl Sun/Solaris OS using Sun fortran,double precision sunf90 27 | sunSUNsgl Sun/Solaris OS using Sun fortran,single precision sunf90 28 | sgiMIPSdbl SGI/IRIX64 OS using MIPS fortran,double precision f90 29 | sgiMIPSsgl SGI/IRIX64 OS using MIPS fortran,single precision f90 30 | 31 | -------------------------------------------------------------------------------- /DATA/MT_CKD_continuum/cntnm.H2O_N2/build/cntnm_v3.2_OS_X_gnu_dbl.obj/cntnm_progr.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielkoll/PyRADS-shortwave/9d86f7dc07bef37f832949a584f0abe2fd3b72c4/DATA/MT_CKD_continuum/cntnm.H2O_N2/build/cntnm_v3.2_OS_X_gnu_dbl.obj/cntnm_progr.o -------------------------------------------------------------------------------- /DATA/MT_CKD_continuum/cntnm.H2O_N2/build/cntnm_v3.2_OS_X_gnu_dbl.obj/contnm.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielkoll/PyRADS-shortwave/9d86f7dc07bef37f832949a584f0abe2fd3b72c4/DATA/MT_CKD_continuum/cntnm.H2O_N2/build/cntnm_v3.2_OS_X_gnu_dbl.obj/contnm.o -------------------------------------------------------------------------------- /DATA/MT_CKD_continuum/cntnm.H2O_N2/build/cntnm_v3.2_OS_X_gnu_dbl.obj/lblparams.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielkoll/PyRADS-shortwave/9d86f7dc07bef37f832949a584f0abe2fd3b72c4/DATA/MT_CKD_continuum/cntnm.H2O_N2/build/cntnm_v3.2_OS_X_gnu_dbl.obj/lblparams.o -------------------------------------------------------------------------------- /DATA/MT_CKD_continuum/cntnm.H2O_N2/build/cntnm_v3.2_OS_X_gnu_dbl.obj/phys_consts.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielkoll/PyRADS-shortwave/9d86f7dc07bef37f832949a584f0abe2fd3b72c4/DATA/MT_CKD_continuum/cntnm.H2O_N2/build/cntnm_v3.2_OS_X_gnu_dbl.obj/phys_consts.o -------------------------------------------------------------------------------- /DATA/MT_CKD_continuum/cntnm.H2O_N2/build/cntnm_v3.2_OS_X_gnu_dbl.obj/planet_earth.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielkoll/PyRADS-shortwave/9d86f7dc07bef37f832949a584f0abe2fd3b72c4/DATA/MT_CKD_continuum/cntnm.H2O_N2/build/cntnm_v3.2_OS_X_gnu_dbl.obj/planet_earth.o -------------------------------------------------------------------------------- /DATA/MT_CKD_continuum/cntnm.H2O_N2/build/lblparams.mod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielkoll/PyRADS-shortwave/9d86f7dc07bef37f832949a584f0abe2fd3b72c4/DATA/MT_CKD_continuum/cntnm.H2O_N2/build/lblparams.mod -------------------------------------------------------------------------------- /DATA/MT_CKD_continuum/cntnm.H2O_N2/build/make_cntnm: -------------------------------------------------------------------------------- 1 | # $Revision: 31594 $ 2 | # Makefile for cntnm 3 | # From cntnm/build directory, type: gmake -f make_cntnm 4 | 5 | # Include file containing user input. Directory is referenced to 6 | # parent directory and common build rules 7 | include makefile.common 8 | 9 | ############################### 10 | # Set variables/ 11 | ############################### 12 | #Set version name. Used in the default OUTPUT and OBJPATH variables. If you 13 | # change those two variables from what is provided here, no need to set this variable. 14 | 15 | PRODUCT = cntnm 16 | VERSION = v3.2 17 | 18 | # Set name of CNTNM executable. 19 | OUTPUT = ${PRODUCT}_$(VERSION)_$(PLTFRM)_$(FC_TYPE)_$(P_TYPE) 20 | 21 | # Set directory for object files. 22 | OBJPATH = ${PRODUCT}_$(VERSION)_$(PLTFRM)_$(FC_TYPE)_$(P_TYPE).obj 23 | 24 | # Set directory containing source files, relative to main directory from which 25 | # you are executing the makefile 26 | SRCPATH = ../src 27 | 28 | 29 | # Files contained in src directory. If additional .f files are added, 30 | # add to this list. 31 | SRCS = cntnm_progr.f90 contnm.f90 lblparams.f90 phys_consts.f90 planet_earth.f90 32 | 33 | # Define makefile name 34 | MAKEFILE=make_$(PRODUCT) 35 | 36 | # Object file names 37 | OBPATH = ${SRCS:.f=.o} 38 | 39 | build : $(OBJPATH)/cntnm_progr.o $(OBJPATH)/contnm.o $(OBJPATH)/lblparams.o $(OBJPATH)/phys_consts.o $(OBJPATH)/planet_earth.o 40 | $(FC) $(FCFLAG) -o ../$(OUTPUT) ${OBJPATH}/*.o 41 | 42 | ## Define dependancies 43 | 44 | $(OBJPATH)/cntnm_progr.o: ${SRCPATH}/cntnm_progr.f90 ${SRCPATH}/contnm.f90 lblparams.mod phys_consts.mod planet_consts.mod 45 | $(FC) -c $(FCFLAG) -I$(SRCPATH) $< -o $@ 46 | $(OBJPATH)/contnm.o: $(SRCPATH)/contnm.f90 lblparams.mod phys_consts.mod 47 | $(FC) -c $(FCFLAG) -I$(SRCPATH) $< -o $@ 48 | lblparams.mod: $(SRCPATH)/lblparams.f90 49 | $(FC) -c $(FCFLAG) $< -o $(OBJPATH)/lblparams.o 50 | phys_consts.mod: $(SRCPATH)/phys_consts.f90 51 | $(FC) -c $(FCFLAG) $< -o $(OBJPATH)/phys_consts.o 52 | planet_consts.mod: $(SRCPATH)/planet_earth.f90 53 | $(FC) -c $(FCFLAG) -I. $< -o $(OBJPATH)/planet_earth.o 54 | $(OBJPATH)/lblparams.o: $(SRCPATH)/lblparams.f90 55 | $(FC) -c $(FCFLAG) -I. $< -o $@ 56 | $(OBJPATH)/phys_consts.o: $(SRCPATH)/phys_consts.f90 57 | $(FC) -c $(FCFLAG) $< -o $@ 58 | $(OBJPATH)/planet_earth.o: $(SRCPATH)/planet_earth.f90 phys_consts.mod 59 | $(FC) -c $(FCFLAG) -I. $< -o $@ 60 | -------------------------------------------------------------------------------- /DATA/MT_CKD_continuum/cntnm.H2O_N2/build/phys_consts.mod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielkoll/PyRADS-shortwave/9d86f7dc07bef37f832949a584f0abe2fd3b72c4/DATA/MT_CKD_continuum/cntnm.H2O_N2/build/phys_consts.mod -------------------------------------------------------------------------------- /DATA/MT_CKD_continuum/cntnm.H2O_N2/build/planet_consts.mod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielkoll/PyRADS-shortwave/9d86f7dc07bef37f832949a584f0abe2fd3b72c4/DATA/MT_CKD_continuum/cntnm.H2O_N2/build/planet_consts.mod -------------------------------------------------------------------------------- /DATA/MT_CKD_continuum/cntnm.H2O_N2/cntnm_v3.2_OS_X_gnu_dbl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielkoll/PyRADS-shortwave/9d86f7dc07bef37f832949a584f0abe2fd3b72c4/DATA/MT_CKD_continuum/cntnm.H2O_N2/cntnm_v3.2_OS_X_gnu_dbl -------------------------------------------------------------------------------- /DATA/MT_CKD_continuum/cntnm.H2O_N2/src/contnm.f90: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielkoll/PyRADS-shortwave/9d86f7dc07bef37f832949a584f0abe2fd3b72c4/DATA/MT_CKD_continuum/cntnm.H2O_N2/src/contnm.f90 -------------------------------------------------------------------------------- /DATA/MT_CKD_continuum/cntnm.H2O_N2/src/lblparams.f90: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielkoll/PyRADS-shortwave/9d86f7dc07bef37f832949a584f0abe2fd3b72c4/DATA/MT_CKD_continuum/cntnm.H2O_N2/src/lblparams.f90 -------------------------------------------------------------------------------- /DATA/MT_CKD_continuum/cntnm.H2O_N2/src/phys_consts.f90: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielkoll/PyRADS-shortwave/9d86f7dc07bef37f832949a584f0abe2fd3b72c4/DATA/MT_CKD_continuum/cntnm.H2O_N2/src/phys_consts.f90 -------------------------------------------------------------------------------- /DATA/MT_CKD_continuum/cntnm.H2O_N2/src/planet_earth.f90: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielkoll/PyRADS-shortwave/9d86f7dc07bef37f832949a584f0abe2fd3b72c4/DATA/MT_CKD_continuum/cntnm.H2O_N2/src/planet_earth.f90 -------------------------------------------------------------------------------- /DATA/MT_CKD_continuum/cntnm.H2O_N2/src/svn_ext_val.txt: -------------------------------------------------------------------------------- 1 | phys_consts.f90 https://svn.aer.com/svn/aer/project/RD/LBLRTM/trunk/src/phys_consts.f90 2 | planet_earth.f90 https://svn.aer.com/svn/aer/project/RD/LBLRTM/trunk/src/planet_earth.f90 3 | contnm.f90 https://svn.aer.com/svn/aer/project/RD/LBLRTM/trunk/src/contnm.f90 4 | lblparams.f90 https://svn.aer.com/svn/aer/project/RD/LBLRTM/trunk/src/lblparams.f90 -------------------------------------------------------------------------------- /DATA/VPL_solar_spectrum/vpl_sunum.txt: -------------------------------------------------------------------------------- 1 | Wavelenth [micron] Flux [W/cm^2/micron] 2 | 0.002 4.227E-07 3 | 0.004 6.895E-07 4 | 0.006 0.000002165 5 | 0.008 0.000001684 6 | 0.01 9.366E-07 7 | 0.012 0.00000041 8 | 0.014 3.553E-07 9 | 0.016 0.000004295 10 | 0.018 0.000003842 11 | 0.02 0.000002609 12 | 0.022 0.000001589 13 | 0.024 0.000001462 14 | 0.026 0.000002231 15 | 0.028 0.000001489 16 | 0.03 0.00000109 17 | 0.03038 0.0004063 18 | 0.032 0.000001039 19 | 0.034 9.793E-07 20 | 0.036 0.000000227 21 | 0.03681 0.00003972 22 | 0.038 2.154E-07 23 | 0.04 2.923E-07 24 | 0.042 3.617E-07 25 | 0.044 3.456E-07 26 | 0.046 6.386E-07 27 | 0.048 2.487E-07 28 | 0.04993 3.231E-07 29 | 0.05 3.011E-07 30 | 0.052 3.794E-07 31 | 0.054 3.656E-07 32 | 0.05545 0.00002852 33 | 0.056 3.372E-07 34 | 0.058 3.257E-07 35 | 0.05847 0.00005349 36 | 0.06 2.144E-07 37 | 0.06094 0.00001462 38 | 0.062 1.043E-07 39 | 0.06253 1.105E-07 40 | 0.06297 0.00004716 41 | 0.064 1.064E-07 42 | 0.066 1.314E-07 43 | 0.068 1.276E-07 44 | 0.07 6.544E-07 45 | 0.072 9.051E-08 46 | 0.074 8.81E-08 47 | 0.076 0.000000449 48 | 0.07646 0.000005179 49 | 0.07704 0.000006245 50 | 0.078 4.376E-07 51 | 0.07902 0.00001987 52 | 0.08 6.861E-07 53 | 0.082 9.214E-07 54 | 0.08342 9.162E-07 55 | 0.084 8.554E-07 56 | 0.086 0.000002015 57 | 0.088 0.00000197 58 | 0.09 0.000001883 59 | 0.092 0.000001704 60 | 0.09231 0.000001808 61 | 0.09334 0.000001788 62 | 0.09378 0.00000178 63 | 0.094 0.000001491 64 | 0.09497 0.000001758 65 | 0.096 7.292E-07 66 | 0.09725 7.269E-07 67 | 0.0977 0.0001208 68 | 0.098 6.784E-07 69 | 0.0991 0.000001085 70 | 0.1 0.00000101 71 | 0.102 0.000001404 72 | 0.1026 0.00008456 73 | 0.1035 0.000004838 74 | 0.106 0.000003703 75 | 0.111 0.000004966 76 | 0.1155 0.000004553 77 | 0.119 0.000004704 78 | 0.121 0.00001011 79 | 0.1216 0.005408 80 | 0.125 0.000002511 81 | 0.13 0.000003559 82 | 0.135 0.000005158 83 | 0.14 0.000004755 84 | 0.145 0.000005373 85 | 0.15 0.000008081 86 | 0.155 0.0000166 87 | 0.16 0.00001787 88 | 0.165 0.00003241 89 | 0.17 0.00005559 90 | 0.175 0.000104 91 | 0.18 0.000177 92 | 0.185 0.0002113 93 | 0.19 0.0003314 94 | 0.195 0.0004855 95 | 0.2 0.0006868 96 | 0.205 0.0009949 97 | 0.21 0.002219 98 | 0.215 0.003297 99 | 0.22 0.004256 100 | 0.225 0.005016 101 | 0.23 0.004806 102 | 0.235 0.004455 103 | 0.24 0.004804 104 | 0.245 0.005459 105 | 0.25 0.004912 106 | 0.255 0.00652 107 | 0.2575 0.01108 108 | 0.2625 0.01465 109 | 0.2675 0.02377 110 | 0.2725 0.02118 111 | 0.2775 0.01741 112 | 0.2825 0.02238 113 | 0.2875 0.03471 114 | 0.2925 0.05426 115 | 0.2975 0.04993 116 | 0.3025 0.05119 117 | 0.3075 0.06161 118 | 0.3125 0.06654 119 | 0.3175 0.07046 120 | 0.3225 0.07852 121 | 0.3275 0.09065 122 | 0.3325 0.09439 123 | 0.3375 0.09416 124 | 0.3425 0.09475 125 | 0.3475 0.09442 126 | 0.3525 0.09878 127 | 0.3575 0.09664 128 | 0.3625 0.1019 129 | 0.3675 0.1146 130 | 0.3725 0.1099 131 | 0.3775 0.10949 132 | 0.3825 0.10395 133 | 0.3875 0.10261 134 | 0.3925 0.10332 135 | 0.3975 0.12878 136 | 0.4025 0.16632 137 | 0.41 0.17329 138 | 0.42 0.17667 139 | 0.43 0.16259 140 | 0.44 0.18254 141 | 0.45 0.20073 142 | 0.46 0.20195 143 | 0.47 0.2002 144 | 0.48 0.19934 145 | 0.49 0.19131 146 | 0.5 0.19106 147 | 0.51 0.18773 148 | 0.52 0.17963 149 | 0.53 0.1859 150 | 0.54 0.18249 151 | 0.55 0.18134 152 | 0.56 0.17743 153 | 0.57 0.17917 154 | 0.58 0.18152 155 | 0.59 0.17714 156 | 0.6 0.17421 157 | 0.61 0.17074 158 | 0.62 0.16769 159 | 0.63 0.16349 160 | 0.64 0.16095 161 | 0.65 0.15396 162 | 0.66 0.15254 163 | 0.67 0.1535 164 | 0.68 0.15097 165 | 0.69 0.14567 166 | 0.7 0.15203 167 | 0.71 0.13882 168 | 0.72 0.13472 169 | 0.73 0.13235 170 | 0.74 0.12791 171 | 0.75 0.12622 172 | 0.76 0.12301 173 | 0.77 0.11861 174 | 0.78 0.11736 175 | 0.79 0.11488 176 | 0.8 0.11198 177 | 0.81 0.10903 178 | 0.82 0.10648 179 | 0.83 0.10328 180 | 0.84 0.1004 181 | 0.85 0.09594 182 | 0.8665 0.096939 183 | 0.9265 0.087183 184 | 0.999 0.076216 185 | 1.053 0.067353 186 | 1.1 0.060667 187 | 1.1665 0.05274 188 | 1.255 0.044231 189 | 1.369 0.036129 190 | 1.498 0.029403 191 | 1.6265 0.023659 192 | 1.775 0.017529 193 | 1.941 0.012089 194 | 2.1115 0.009071 195 | 2.342 0.0068345 196 | 2.5705 0.0051117 197 | 2.79 0.004 198 | 3.0795 0.0028119 199 | 3.408 0.0017751 200 | 3.7935 0.0011755 201 | 4.091 0.00088272 202 | -------------------------------------------------------------------------------- /DATA/VPL_solar_spectrum/vpl_sunum.txt.bak: -------------------------------------------------------------------------------- 1 | Wavelenth [micron] Flux [W/cm^2/micron] 2 | 0.002 4.227E-07 3 | 0.004 6.895E-07 4 | 0.006 0.000002165 5 | 0.008 0.000001684 6 | 0.01 9.366E-07 7 | 0.012 0.00000041 8 | 0.014 3.553E-07 9 | 0.016 0.000004295 10 | 0.018 0.000003842 11 | 0.02 0.000002609 12 | 0.022 0.000001589 13 | 0.024 0.000001462 14 | 0.026 0.000002231 15 | 0.028 0.000001489 16 | 0.03 0.00000109 17 | 0.03038 0.0004063 18 | 0.032 0.000001039 19 | 0.034 9.793E-07 20 | 0.036 0.000000227 21 | 0.03681 0.00003972 22 | 0.038 2.154E-07 23 | 0.04 2.923E-07 24 | 0.042 3.617E-07 25 | 0.044 3.456E-07 26 | 0.046 6.386E-07 27 | 0.048 2.487E-07 28 | 0.04993 3.231E-07 29 | 0.05 3.011E-07 30 | 0.052 3.794E-07 31 | 0.054 3.656E-07 32 | 0.05545 0.00002852 33 | 0.056 3.372E-07 34 | 0.058 3.257E-07 35 | 0.05847 0.00005349 36 | 0.06 2.144E-07 37 | 0.06094 0.00001462 38 | 0.062 1.043E-07 39 | 0.06253 1.105E-07 40 | 0.06297 0.00004716 41 | 0.064 1.064E-07 42 | 0.066 1.314E-07 43 | 0.068 1.276E-07 44 | 0.07 6.544E-07 45 | 0.072 9.051E-08 46 | 0.074 8.81E-08 47 | 0.076 0.000000449 48 | 0.07646 0.000005179 49 | 0.07704 0.000006245 50 | 0.078 4.376E-07 51 | 0.07902 0.00001987 52 | 0.08 6.861E-07 53 | 0.082 9.214E-07 54 | 0.08342 9.162E-07 55 | 0.084 8.554E-07 56 | 0.086 0.000002015 57 | 0.088 0.00000197 58 | 0.09 0.000001883 59 | 0.092 0.000001704 60 | 0.09231 0.000001808 61 | 0.09334 0.000001788 62 | 0.09378 0.00000178 63 | 0.094 0.000001491 64 | 0.09497 0.000001758 65 | 0.096 7.292E-07 66 | 0.09725 7.269E-07 67 | 0.0977 0.0001208 68 | 0.098 6.784E-07 69 | 0.0991 0.000001085 70 | 0.1 0.00000101 71 | 0.102 0.000001404 72 | 0.1026 0.00008456 73 | 0.1035 0.000004838 74 | 0.106 0.000003703 75 | 0.111 0.000004966 76 | 0.1155 0.000004553 77 | 0.119 0.000004704 78 | 0.121 0.00001011 79 | 0.1216 0.005408 80 | 0.125 0.000002511 81 | 0.13 0.000003559 82 | 0.135 0.000005158 83 | 0.14 0.000004755 84 | 0.145 0.000005373 85 | 0.15 0.000008081 86 | 0.155 0.0000166 87 | 0.16 0.00001787 88 | 0.165 0.00003241 89 | 0.17 0.00005559 90 | 0.175 0.000104 91 | 0.18 0.000177 92 | 0.185 0.0002113 93 | 0.19 0.0003314 94 | 0.195 0.0004855 95 | 0.2 0.0006868 96 | 0.205 0.0009949 97 | 0.21 0.002219 98 | 0.215 0.003297 99 | 0.22 0.004256 100 | 0.225 0.005016 101 | 0.23 0.004806 102 | 0.235 0.004455 103 | 0.24 0.004804 104 | 0.245 0.005459 105 | 0.25 0.004912 106 | 0.255 0.00652 107 | 0.2575 0.01108 108 | 0.2625 0.01465 109 | 0.2675 0.02377 110 | 0.2725 0.02118 111 | 0.2775 0.01741 112 | 0.2825 0.02238 113 | 0.2875 0.03471 114 | 0.2925 0.05426 115 | 0.2975 0.04993 116 | 0.3025 0.05119 117 | 0.3075 0.06161 118 | 0.3125 0.06654 119 | 0.3175 0.07046 120 | 0.3225 0.07852 121 | 0.3275 0.09065 122 | 0.3325 0.09439 123 | 0.3375 0.09416 124 | 0.3425 0.09475 125 | 0.3475 0.09442 126 | 0.3525 0.09878 127 | 0.3575 0.09664 128 | 0.3625 0.1019 129 | 0.3675 0.1146 130 | 0.3725 0.1099 131 | 0.3775 0.10949 132 | 0.3825 0.10395 133 | 0.3875 0.10261 134 | 0.3925 0.10332 135 | 0.3975 0.12878 136 | 0.4025 0.16632 137 | 0.41 0.17329 138 | 0.42 0.17667 139 | 0.43 0.16259 140 | 0.44 0.18254 141 | 0.45 0.20073 142 | 0.46 0.20195 143 | 0.47 0.2002 144 | 0.48 0.19934 145 | 0.49 0.19131 146 | 0.5 0.19106 147 | 0.51 0.18773 148 | 0.52 0.17963 149 | 0.53 0.1859 150 | 0.54 0.18249 151 | 0.55 0.18134 152 | 0.56 0.17743 153 | 0.57 0.17917 154 | 0.58 0.18152 155 | 0.59 0.17714 156 | 0.6 0.17421 157 | 0.61 0.17074 158 | 0.62 0.16769 159 | 0.63 0.16349 160 | 0.64 0.16095 161 | 0.65 0.15396 162 | 0.66 0.15254 163 | 0.67 0.1535 164 | 0.68 0.15097 165 | 0.69 0.14567 166 | 0.7 0.15203 167 | 0.71 0.13882 168 | 0.72 0.13472 169 | 0.73 0.13235 170 | 0.74 0.12791 171 | 0.75 0.12622 172 | 0.76 0.12301 173 | 0.77 0.11861 174 | 0.78 0.11736 175 | 0.79 0.11488 176 | 0.8 0.11198 177 | 0.81 0.10903 178 | 0.82 0.10648 179 | 0.83 0.10328 180 | 0.84 0.1004 181 | 0.85 0.09594 182 | 0.8665 0.096939 183 | 0.9265 0.087183 184 | 0.999 0.076216 185 | 1.053 0.067353 186 | 1.1 0.060667 187 | 1.1665 0.05274 188 | 1.255 0.044231 189 | 1.369 0.036129 190 | 1.498 0.029403 191 | 1.6265 0.023659 192 | 1.775 0.017529 193 | 1.941 0.012089 194 | 2.1115 0.009071 195 | 2.342 0.0068345 196 | 2.5705 0.0051117 197 | 2.79 0.004 198 | 3.0795 0.0028119 199 | 3.408 0.0017751 200 | 3.7935 0.0011755 201 | 4.091 0.00088272 202 | 4.3585 0.0031367 203 | -------------------------------------------------------------------------------- /DATA/VPL_solar_spectrum/vpl_sunum_extended.txt: -------------------------------------------------------------------------------- 1 | # Wavelength [micron] Flux [W/cm2/micron] 2 | 0.00200 4.227000000e-07 3 | 0.00400 6.895000000e-07 4 | 0.00600 2.165000000e-06 5 | 0.00800 1.684000000e-06 6 | 0.01000 9.366000000e-07 7 | 0.01200 4.100000000e-07 8 | 0.01400 3.553000000e-07 9 | 0.01600 4.295000000e-06 10 | 0.01800 3.842000000e-06 11 | 0.02000 2.609000000e-06 12 | 0.02200 1.589000000e-06 13 | 0.02400 1.462000000e-06 14 | 0.02600 2.231000000e-06 15 | 0.02800 1.489000000e-06 16 | 0.03000 1.090000000e-06 17 | 0.03038 4.063000000e-04 18 | 0.03200 1.039000000e-06 19 | 0.03400 9.793000000e-07 20 | 0.03600 2.270000000e-07 21 | 0.03681 3.972000000e-05 22 | 0.03800 2.154000000e-07 23 | 0.04000 2.923000000e-07 24 | 0.04200 3.617000000e-07 25 | 0.04400 3.456000000e-07 26 | 0.04600 6.386000000e-07 27 | 0.04800 2.487000000e-07 28 | 0.04993 3.231000000e-07 29 | 0.05000 3.011000000e-07 30 | 0.05200 3.794000000e-07 31 | 0.05400 3.656000000e-07 32 | 0.05545 2.852000000e-05 33 | 0.05600 3.372000000e-07 34 | 0.05800 3.257000000e-07 35 | 0.05847 5.349000000e-05 36 | 0.06000 2.144000000e-07 37 | 0.06094 1.462000000e-05 38 | 0.06200 1.043000000e-07 39 | 0.06253 1.105000000e-07 40 | 0.06297 4.716000000e-05 41 | 0.06400 1.064000000e-07 42 | 0.06600 1.314000000e-07 43 | 0.06800 1.276000000e-07 44 | 0.07000 6.544000000e-07 45 | 0.07200 9.051000000e-08 46 | 0.07400 8.810000000e-08 47 | 0.07600 4.490000000e-07 48 | 0.07646 5.179000000e-06 49 | 0.07704 6.245000000e-06 50 | 0.07800 4.376000000e-07 51 | 0.07902 1.987000000e-05 52 | 0.08000 6.861000000e-07 53 | 0.08200 9.214000000e-07 54 | 0.08342 9.162000000e-07 55 | 0.08400 8.554000000e-07 56 | 0.08600 2.015000000e-06 57 | 0.08800 1.970000000e-06 58 | 0.09000 1.883000000e-06 59 | 0.09200 1.704000000e-06 60 | 0.09231 1.808000000e-06 61 | 0.09334 1.788000000e-06 62 | 0.09378 1.780000000e-06 63 | 0.09400 1.491000000e-06 64 | 0.09497 1.758000000e-06 65 | 0.09600 7.292000000e-07 66 | 0.09725 7.269000000e-07 67 | 0.09770 1.208000000e-04 68 | 0.09800 6.784000000e-07 69 | 0.09910 1.085000000e-06 70 | 0.10000 1.010000000e-06 71 | 0.10200 1.404000000e-06 72 | 0.10260 8.456000000e-05 73 | 0.10350 4.838000000e-06 74 | 0.10600 3.703000000e-06 75 | 0.11100 4.966000000e-06 76 | 0.11550 4.553000000e-06 77 | 0.11900 4.704000000e-06 78 | 0.12100 1.011000000e-05 79 | 0.12160 5.408000000e-03 80 | 0.12500 2.511000000e-06 81 | 0.13000 3.559000000e-06 82 | 0.13500 5.158000000e-06 83 | 0.14000 4.755000000e-06 84 | 0.14500 5.373000000e-06 85 | 0.15000 8.081000000e-06 86 | 0.15500 1.660000000e-05 87 | 0.16000 1.787000000e-05 88 | 0.16500 3.241000000e-05 89 | 0.17000 5.559000000e-05 90 | 0.17500 1.040000000e-04 91 | 0.18000 1.770000000e-04 92 | 0.18500 2.113000000e-04 93 | 0.19000 3.314000000e-04 94 | 0.19500 4.855000000e-04 95 | 0.20000 6.868000000e-04 96 | 0.20500 9.949000000e-04 97 | 0.21000 2.219000000e-03 98 | 0.21500 3.297000000e-03 99 | 0.22000 4.256000000e-03 100 | 0.22500 5.016000000e-03 101 | 0.23000 4.806000000e-03 102 | 0.23500 4.455000000e-03 103 | 0.24000 4.804000000e-03 104 | 0.24500 5.459000000e-03 105 | 0.25000 4.912000000e-03 106 | 0.25500 6.520000000e-03 107 | 0.25750 1.108000000e-02 108 | 0.26250 1.465000000e-02 109 | 0.26750 2.377000000e-02 110 | 0.27250 2.118000000e-02 111 | 0.27750 1.741000000e-02 112 | 0.28250 2.238000000e-02 113 | 0.28750 3.471000000e-02 114 | 0.29250 5.426000000e-02 115 | 0.29750 4.993000000e-02 116 | 0.30250 5.119000000e-02 117 | 0.30750 6.161000000e-02 118 | 0.31250 6.654000000e-02 119 | 0.31750 7.046000000e-02 120 | 0.32250 7.852000000e-02 121 | 0.32750 9.065000000e-02 122 | 0.33250 9.439000000e-02 123 | 0.33750 9.416000000e-02 124 | 0.34250 9.475000000e-02 125 | 0.34750 9.442000000e-02 126 | 0.35250 9.878000000e-02 127 | 0.35750 9.664000000e-02 128 | 0.36250 1.019000000e-01 129 | 0.36750 1.146000000e-01 130 | 0.37250 1.099000000e-01 131 | 0.37750 1.094900000e-01 132 | 0.38250 1.039500000e-01 133 | 0.38750 1.026100000e-01 134 | 0.39250 1.033200000e-01 135 | 0.39750 1.287800000e-01 136 | 0.40250 1.663200000e-01 137 | 0.41000 1.732900000e-01 138 | 0.42000 1.766700000e-01 139 | 0.43000 1.625900000e-01 140 | 0.44000 1.825400000e-01 141 | 0.45000 2.007300000e-01 142 | 0.46000 2.019500000e-01 143 | 0.47000 2.002000000e-01 144 | 0.48000 1.993400000e-01 145 | 0.49000 1.913100000e-01 146 | 0.50000 1.910600000e-01 147 | 0.51000 1.877300000e-01 148 | 0.52000 1.796300000e-01 149 | 0.53000 1.859000000e-01 150 | 0.54000 1.824900000e-01 151 | 0.55000 1.813400000e-01 152 | 0.56000 1.774300000e-01 153 | 0.57000 1.791700000e-01 154 | 0.58000 1.815200000e-01 155 | 0.59000 1.771400000e-01 156 | 0.60000 1.742100000e-01 157 | 0.61000 1.707400000e-01 158 | 0.62000 1.676900000e-01 159 | 0.63000 1.634900000e-01 160 | 0.64000 1.609500000e-01 161 | 0.65000 1.539600000e-01 162 | 0.66000 1.525400000e-01 163 | 0.67000 1.535000000e-01 164 | 0.68000 1.509700000e-01 165 | 0.69000 1.456700000e-01 166 | 0.70000 1.520300000e-01 167 | 0.71000 1.388200000e-01 168 | 0.72000 1.347200000e-01 169 | 0.73000 1.323500000e-01 170 | 0.74000 1.279100000e-01 171 | 0.75000 1.262200000e-01 172 | 0.76000 1.230100000e-01 173 | 0.77000 1.186100000e-01 174 | 0.78000 1.173600000e-01 175 | 0.79000 1.148800000e-01 176 | 0.80000 1.119800000e-01 177 | 0.81000 1.090300000e-01 178 | 0.82000 1.064800000e-01 179 | 0.83000 1.032800000e-01 180 | 0.84000 1.004000000e-01 181 | 0.85000 9.594000000e-02 182 | 0.86650 9.693900000e-02 183 | 0.92650 8.718300000e-02 184 | 0.99900 7.621600000e-02 185 | 1.05300 6.735300000e-02 186 | 1.10000 6.066700000e-02 187 | 1.16650 5.274000000e-02 188 | 1.25500 4.423100000e-02 189 | 1.36900 3.612900000e-02 190 | 1.49800 2.940300000e-02 191 | 1.62650 2.365900000e-02 192 | 1.77500 1.752900000e-02 193 | 1.94100 1.208900000e-02 194 | 2.11150 9.071000000e-03 195 | 2.34200 6.834500000e-03 196 | 2.57050 5.111700000e-03 197 | 2.79000 4.000000000e-03 198 | 3.07950 2.811900000e-03 199 | 3.40800 1.775100000e-03 200 | 3.79350 1.175500000e-03 201 | 4.09100 8.827200000e-04 202 | 4.29100 7.293010293e-04 203 | 4.49100 6.078111523e-04 204 | 4.69100 5.105980511e-04 205 | 4.89100 4.320661403e-04 206 | 5.09100 3.680683688e-04 207 | 5.29100 3.154930804e-04 208 | 5.49100 2.719788354e-04 209 | 5.69100 2.357146320e-04 210 | 5.89100 2.052980355e-04 211 | 6.09100 1.796331504e-04 212 | 6.29100 1.578563817e-04 213 | 6.49100 1.392818248e-04 214 | 6.69100 1.233606830e-04 215 | 6.89100 1.096508203e-04 216 | 7.09100 9.779371469e-05 217 | 7.29100 8.749686481e-05 218 | 7.49100 7.852025409e-05 219 | 7.69100 7.066585846e-05 220 | 7.89100 6.376945584e-05 221 | 8.09100 5.769418993e-05 222 | 8.29100 5.232548037e-05 223 | 8.49100 4.756697364e-05 224 | 8.69100 4.333730344e-05 225 | 8.89100 3.956748475e-05 226 | 9.09100 3.619880665e-05 227 | 9.29100 3.318112024e-05 228 | 9.49100 3.047144089e-05 229 | 9.69100 2.803280205e-05 230 | 9.89100 2.583331129e-05 231 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Daniel D.B. Koll 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PyRADS 2 | PyRADS is the Python line-by-line RADiation model for planetary atmosphereS. PyRADS is a radiation code that can provide line-by-line spectral resolution, yet is written in Python and so is flexible enough to be useful in teaching. 3 | 4 | For Earth-like atmospheres, PyRADS currently uses HITRAN 2016 line lists (http://hitran.org/) and the MTCKD continuum model (http://rtweb.aer.com/continuum_frame.html). 5 | 6 | This version of PyRADS tackles shortwave calculations using the DISORT radiative solver. 7 | 8 | References: 9 | 10 | (1) Koll & Cronin, 2018, https://doi.org/10.1073/pnas.1809868115. 11 | 12 | (2) Koll & Cronin, 2019, https://arxiv.org/abs/1907.13169. 13 | 14 | (3) Stamnes et al, 1988, Applied Optics. 15 | 16 | # Installation 17 | 1) Download to your own computer. 18 | 19 | 2) Manually compile the MTCKD model: 20 | - cd $PyRADS/DATA/MT_CKD_continuum/cntnm.H2O_N2/build 21 | - (on a Mac) make -f make_cntnm osxGNUdbl 22 | - (on a Mac if you are using gfortran installed with conda) make -f make_cntnm osxGNUCONDAdbl 23 | 24 | 3) Manually install the pyDISORT wrapper, which solves 25 | the radiative transfer equations with scattering (=in the shortwave). 26 | Steps marked with (x) use conda to create a separate environment, and are optional. 27 | 28 | - (x) conda create --clone base --name base_w_pyDISORT 29 | - (x) source activate base_w_pyDISORT 30 | - cd $PyRADS/pyDISORT-master 31 | - python setup.py install 32 | 33 | To test whether pyDISORT was successfully installed: 34 | - cd $PyRADS/pyDISORT-master/test 35 | - python test_disort.py 36 | - python test_Rayleigh.py 37 | 38 | If the installation failed, the test scripts will return "ImportError: No module named disort". 39 | If the installation worked, the test scripts will print a large slew of output. 40 | If using a separate conda environment, later remember to load that environment with 'source activate' before 41 | running pyDISORT or importing pyRADS. 42 | 43 | 4) Run test scripts 44 | 45 | To compute outgoing longwave radiation (OLR) in W/m2 for a given surface temperature: 46 | - cd $PyRADS/Test01.olr 47 | - python compute_olr_h2o.py 48 | 49 | To compute OLRs for a set of surface temperatures and save the resulting output to txt: 50 | - cd $PyRADS/Test02.runaway 51 | - python compute_olr_h2o.01.100RH.py 52 | 53 | To compute SW fluxes in W/m2 for a given surface temperature (here, 300 K) over a *limited* part of the solar spectrum (here, 1000-2000 cm-1) at some resolution (here, 1 cm-1; see note below) and save the resulting output to txt file in the same directory ("."): 54 | - cd $PyRADS/Test03.sw 55 | - python compute_sw_h2o.py 1000. 2000. 1. 300. . 56 | 57 | To stitch together the SW fluxes across the entire solar spectrum (takes a while even at low spectral res; see note below): 58 | - cd $PyRADS/Test04.sw_full_spectrum 59 | - python compute_sw_h2o.py 1000. 10000. 1. 300. . 60 | - python compute_sw_h2o.py 10000. 20000. 1. 300. . 61 | - python compute_sw_h2o.py 20000. 30000. 1. 300. . 62 | - python compute_sw_h2o.py 30000. 90000. 10. 300. . 63 | - python merge_spectrum.py 64 | 65 | NOTE: computing opacities + running pyDISORT over the entire solar spectrum becomes computationally very costly. It is much faster to split the spectral calculations up over many spectral chunks, distribute those over parallel processors, and them combine the spectral resolved calculations at the end. Use Merge_Spectral_Output.py to combine discrete chunks of the spectrum. 66 | 67 | NOTE: spectral resolution should reflect the available data. E.g., HITRAN2016 doesn't contain H2O lines beyond ~25000 cm-1, so there is no need to retain high spectral resolution in the UV. 68 | 69 | NOTE: resolution in test scripts was chosen for relative speed, not accuracy. For research-grade output and model intercomparisons, vertical and spectral resolution need to be increased. For some reference values, see Methods in Koll & Cronin (2018) and Koll & Cronin (2019). 70 | 71 | 72 | # Requirements 73 | Python 2 or 3 with numpy and scipy. 74 | 75 | For the MTCKD continuum model: gmake and gfortran. 76 | 77 | For the pyDISORT radiation solver: see https://github.com/chanGimeno/pyDISORT. 78 | 79 | # Acknowledgements 80 | PyRADS makes use of HITRAN 2016 line lists (http://hitran.org/), AER's MTCKD continuum model (http://rtweb.aer.com/continuum_frame.html), and the PyTran script published by Ray Pierrehumbert as part of the courseware for "Principles of Planetary Climates" (https://geosci.uchicago.edu/~rtp1/PrinciplesPlanetaryClimate/). Brian Rose (http://www.atmos.albany.edu/facstaff/brose/) has helped improve the code. The SW version of PyRADS uses DISORT, developed by Stamnes et al, and the pyDISORT wrapper, developed by chanGimeno (https://github.com/chanGimeno/pyDISORT). 81 | -------------------------------------------------------------------------------- /Test01.olr/compute_olr_h2o.py: -------------------------------------------------------------------------------- 1 | from __future__ import division, print_function 2 | import numpy as np 3 | import sys,os 4 | 5 | sys.path.append("..") 6 | import pyrads 7 | 8 | from scipy.integrate import trapz,simps,cumtrapz 9 | 10 | ### ----------------------------------- 11 | ### Helpers 12 | class Dummy: 13 | pass 14 | 15 | 16 | ### ----------------------------------- 17 | 18 | # --- 19 | ## setup thermodynamic parameters 20 | params = Dummy() 21 | 22 | params.Rv = pyrads.phys.H2O.R # moist component 23 | params.cpv = pyrads.phys.H2O.cp 24 | params.Lvap = pyrads.phys.H2O.L_vaporization_TriplePoint 25 | params.satvap_T0 = pyrads.phys.H2O.TriplePointT 26 | params.satvap_e0 = pyrads.phys.H2O.TriplePointP 27 | params.esat = lambda T: pyrads.Thermodynamics.get_satvps(T,params.satvap_T0,params.satvap_e0,params.Rv,params.Lvap) 28 | 29 | params.R = pyrads.phys.air.R # dry component 30 | params.cp = pyrads.phys.air.cp 31 | params.ps_dry = 1e5 # surface pressure of dry component 32 | 33 | params.g = 9.8 # surface gravity 34 | params.cosThetaBar = 3./5. # average zenith angle used in 2stream eqns 35 | params.RH = 1. # relative humidity 36 | 37 | # --- 38 | ## setup resolution (vertical,spectral) 39 | 40 | N_press = 15 # for testing only! 41 | dwavenr = 0.1 # for testing only! 42 | 43 | #N_press = 60 # 44 | wavenr_min = 0.1 # [cm^-1] 45 | wavenr_max = 3500. # 46 | #dwavenr = 0.01 # 47 | 48 | Tstrat = 150. # stratospheric temperature 49 | 50 | # --- 51 | ## setup range of temperatures, and if/where output is saved to: 52 | 53 | Ts = 300. 54 | 55 | ### ----------------------------------- 56 | ## MAIN LOOP 57 | 58 | print( "wavenr_min,wavenr_max,dwave [cm^-1] = %.4f,%.4f,%.4f" % (wavenr_min,wavenr_max,dwavenr)) 59 | print( "\n") 60 | print( "N_press = %.1f" % N_press) 61 | print( "\n") 62 | print( "Surface temperature = %.1f K" % Ts) 63 | 64 | 65 | # setup grid: 66 | g = pyrads.SetupGrids.make_grid( Ts,Tstrat,N_press,wavenr_min,wavenr_max,dwavenr,params, RH=params.RH ) 67 | 68 | # compute optical thickness: 69 | # -> this is the computationally most intensive step 70 | g.tau,g.omega = pyrads.OpticalThickness.compute_tau_omega_H2ON2(g.p,g.T,g.q,g,params, RH=params.RH ) 71 | 72 | # compute Planck functions etc: 73 | # -> here: fully spectrally resolved! 74 | T_2D = np.tile( g.T, (g.Nn,1) ).T # [press x wave] 75 | g.B_surf = np.pi* pyrads.Planck.Planck_n( g.n,Ts ) # [wave] 76 | g.B = np.pi* pyrads.Planck.Planck_n( g.wave, T_2D ) # [press x wave] 77 | 78 | # compute OLR etc: 79 | olr_spec = pyrads.Get_Fluxes.Fplus_alternative(0,g) # (spectrally resolved=irradiance) 80 | olr = simps(olr_spec,g.n) 81 | 82 | print( "OLR = ",olr) 83 | -------------------------------------------------------------------------------- /Test02.runaway/compute_olr_h2o.01.100RH.py: -------------------------------------------------------------------------------- 1 | from __future__ import division, print_function 2 | import numpy as np 3 | import sys,os 4 | 5 | sys.path.append("..") 6 | import pyrads 7 | 8 | from scipy.integrate import trapz,simps,cumtrapz 9 | 10 | ### ----------------------------------- 11 | ### Helpers 12 | class Dummy: 13 | pass 14 | 15 | 16 | ### ----------------------------------- 17 | 18 | # --- 19 | ## setup thermodynamic parameters 20 | params = Dummy() 21 | 22 | params.Rv = pyrads.phys.H2O.R # moist component 23 | params.cpv = pyrads.phys.H2O.cp 24 | params.Lvap = pyrads.phys.H2O.L_vaporization_TriplePoint 25 | params.satvap_T0 = pyrads.phys.H2O.TriplePointT 26 | params.satvap_e0 = pyrads.phys.H2O.TriplePointP 27 | params.esat = lambda T: pyrads.Thermodynamics.get_satvps(T,params.satvap_T0,params.satvap_e0,params.Rv,params.Lvap) 28 | 29 | params.R = pyrads.phys.air.R # dry component 30 | params.cp = pyrads.phys.air.cp 31 | params.ps_dry = 1e5 # surface pressure of dry component 32 | 33 | params.g = 9.8 # surface gravity 34 | params.cosThetaBar = 3./5. # average zenith angle used in 2stream eqns 35 | params.RH = 1. # relative humidity 36 | 37 | # --- 38 | ## setup resolution (vertical,spectral) 39 | 40 | #N_press = 60 # 41 | N_press = 15 # 42 | wavenr_min = 0.1 # [cm^-1] 43 | wavenr_max = 3500. # 44 | #dwavenr = 0.01 # 45 | dwavenr = 0.1 # 46 | 47 | Tstrat = 150. # stratospheric temperature 48 | 49 | # --- 50 | ## setup range of temperatures, and if/where output is saved to: 51 | 52 | #Ts_grid = np.arange(170.,370.1,10.) 53 | Ts_grid = np.arange(170.,370.1,20.) 54 | filename = 'output.compute_olr_h2o.01.100RH.txt' 55 | 56 | saveOutput = True # Save the output/plots? [Yes/No] 57 | if saveOutput: 58 | OUTDIR = "./" 59 | print( "Saving output to ",OUTDIR) 60 | if not os.path.isdir( OUTDIR ): 61 | os.makedirs( OUTDIR ) 62 | 63 | 64 | ### ----------------------------------- 65 | ## MAIN LOOP 66 | 67 | # save resolution etc for a given loop to file: 68 | if saveOutput: 69 | f = open(OUTDIR+filename,'w') 70 | f.write("wavenr_min,wavenr_max,dwave [cm^-1] = %.4f,%.4f,%.4f" % (wavenr_min,wavenr_max,dwavenr) ) 71 | f.write("\n") 72 | f.write("N_press = %.1f" % N_press ) 73 | f.write("\n") 74 | f.write("\n") 75 | f.write("Ts [K],\tps [bar],\tolr [W/m2],\tsurface contribution to olr [W/m2],\tTransmission int[T dBdT(Ts) dn]/int[ dBdT(Ts) dn],\tSimple feedback model int[dB/dT*T]") 76 | f.write("\n") 77 | 78 | f.close() 79 | 80 | ## main loop here 81 | for Ts in Ts_grid: 82 | f = open(OUTDIR+filename,'a') 83 | 84 | # setup grid: 85 | g = pyrads.SetupGrids.make_grid( Ts,Tstrat,N_press,wavenr_min,wavenr_max,dwavenr,params, RH=params.RH ) 86 | 87 | # compute optical thickness: 88 | # -> this is the computationally most intensive step 89 | g.tau,g.omega = pyrads.OpticalThickness.compute_tau_omega_H2ON2(g.p,g.T,g.q,g,params, RH=params.RH ) 90 | 91 | # compute Planck functions etc: 92 | # -> here: fully spectrally resolved! 93 | T_2D = np.tile( g.T, (g.Nn,1) ).T # [press x wave] 94 | g.B_surf = np.pi* pyrads.Planck.Planck_n( g.n,Ts ) # [wave] 95 | g.B = np.pi* pyrads.Planck.Planck_n( g.wave, T_2D ) # [press x wave] 96 | 97 | # compute OLR etc: 98 | olr_spec = pyrads.Get_Fluxes.Fplus_alternative(0,g) # (spectrally resolved=irradiance) 99 | olr = simps(olr_spec,g.n) 100 | 101 | # compute fraction of surface flux that makes it to space 102 | surf_spec = g.B_surf * np.exp(-g.tau[-1,:]) 103 | surf = simps(surf_spec,x=g.n) 104 | 105 | # compute spectrally averaged transmission function... 106 | weight = np.pi* pyrads.Planck.dPlanckdT_n( g.n,Ts ) 107 | trans = trapz( np.exp(-g.tau[-1,:]) * weight,x=g.n ) / trapz( weight,x=g.n ) 108 | 109 | # Simple feedback model (like above, without normalization) 110 | weight = np.pi* pyrads.Planck.dPlanckdT_n( g.n,Ts ) 111 | lam = trapz( np.exp(-g.tau[-1,:]) * weight,x=g.n ) 112 | 113 | print( "\n",Ts,g.ps/1e5,olr,surf, "\n") 114 | 115 | f.write("%.2f,\t%.4f,\t%.8f,\t%.8f,\t%.8f,\t%.8f" % (Ts,g.ps/1e5,olr,surf,trans,lam) ) 116 | f.write("\n") 117 | 118 | f.close() 119 | -------------------------------------------------------------------------------- /Test03.sw/compute_sw_h2o.py: -------------------------------------------------------------------------------- 1 | from __future__ import division, print_function 2 | import numpy as np 3 | import sys,os 4 | 5 | sys.path.append("..") 6 | import pyrads 7 | 8 | from scipy.integrate import trapz,simps,cumtrapz 9 | import time 10 | 11 | ### ----------------------------------- 12 | ### Helpers 13 | class Dummy: 14 | pass 15 | 16 | 17 | ### ----------------------------------- 18 | 19 | # --- 20 | ## setup thermodynamic parameters 21 | params = Dummy() 22 | 23 | params.Rv = pyrads.phys.H2O.R # moist component 24 | params.cpv = pyrads.phys.H2O.cp 25 | params.Lvap = pyrads.phys.H2O.L_vaporization_TriplePoint 26 | params.satvap_T0 = pyrads.phys.H2O.TriplePointT 27 | params.satvap_e0 = pyrads.phys.H2O.TriplePointP 28 | params.esat = lambda T: pyrads.Thermodynamics.get_satvps(T,params.satvap_T0,params.satvap_e0,params.Rv,params.Lvap) 29 | 30 | params.R = pyrads.phys.air.R # dry component 31 | params.cp = pyrads.phys.air.cp 32 | params.ps_dry = 1e5 # surface pressure of dry component 33 | 34 | params.g = 9.8 # surface gravity 35 | params.cosThetaBar = 3./5. # average zenith angle used in 2stream eqns 36 | params.RH = 1. # relative humidity 37 | 38 | 39 | ## scattering parameters: 40 | params.Lstar = 1365. # ... 41 | params.alpha_surf = 0.12 # surface albedo 42 | 43 | params.Tstar = 5800. 44 | params.sourceFn = lambda wave: np.pi * pyrads.Planck.Planck_n(wave,params.Tstar) * \ 45 | (params.Lstar)/(pyrads.phys.sigma* params.Tstar**4) # units = W/m2/cm^-1 46 | 47 | params.zenith_list = np.array([7.5,22.5,37.5,52.5,67.5,82.5]) # angles for scattering? 48 | 49 | ## other parameters: 50 | params.Tstrat = 150. 51 | 52 | ## numerical parameters: 53 | params.N_press = 15 # MAKE SURE THIS IS AN 'INT'! -- chosen low res for testing only! 54 | params.RH = 1. 55 | 56 | 57 | 58 | ### ----------------------------------- 59 | ### Main 60 | 61 | def main(wavenr_min,wavenr_max,dwavenr,Ts,OUTDIR='./'): 62 | print( "Ts, wavenr_min, wavenr_max, dwave = ", Ts,wavenr_min,wavenr_max,dwavenr ) 63 | 64 | 65 | # ---- 66 | # setup grid: 67 | grid = pyrads.SetupGrids.make_grid( Ts,params.Tstrat,params.N_press, \ 68 | wavenr_min,wavenr_max,dwavenr, \ 69 | params, pTOA_decade=-4, RH=params.RH ) 70 | 71 | 72 | # ---- 73 | # compute optical thickness: 74 | print( "Compute tau, omega... " ) 75 | grid.tau,grid.omega = pyrads.OpticalThickness.compute_tau_omega_H2ON2(grid.p,grid.T,grid.q,grid,params, RH=params.RH ) 76 | print( "Done " ) 77 | 78 | # --- 79 | # compute SW fluxes 80 | # run pyDISORT over all zenith angles -> this can get long! 81 | 82 | grid.output_angles = [] 83 | 84 | start01 = time.time() # TESTING 85 | for zenith in params.zenith_list: 86 | print( "\n---" ) 87 | print( "\nZenith angle = ", zenith ) 88 | 89 | cosz = np.cos( zenith * np.pi/180. ) 90 | 91 | # 92 | out = Dummy() 93 | out.zenith = zenith 94 | out.cosz = cosz 95 | 96 | # run pyDISORT 97 | SWdirect_spec,SWplus_spec,SWminus_spec = pyrads.Get_Fluxes_pyDISORT.get_fluxes( \ 98 | grid.p*0.9999, \ 99 | grid.p,grid.T, \ 100 | grid.n, grid.tau, grid.omega, \ 101 | cosz, params.Lstar,params.alpha_surf, \ 102 | N_streams=4,doThermal=False, \ 103 | sourceFn=params.sourceFn ) 104 | 105 | # convert to total fluxes 106 | # output has same units as source fn 107 | # integrate to get W/m2 108 | out.SWdirect = np.trapz( SWdirect_spec,x=grid.n,axis=-1 ) 109 | out.SWplus = np.trapz( SWplus_spec,x=grid.n,axis=-1 ) 110 | out.SWminus = np.trapz( SWminus_spec,x=grid.n,axis=-1 ) 111 | 112 | # 113 | grid.output_angles.append( out ) 114 | 115 | print( "Done! \n" ) 116 | end01 = time.time() # TESTING 117 | print( "***\nTiming for all solar angles: ", end01-start01, "\n***" ) # TESTING 118 | 119 | # --- 120 | # save to file 121 | OUTDIR = OUTDIR + "/" # (make sure to add a '/' at end!!) 122 | print( "Saving output to ",OUTDIR ) 123 | if not os.path.isdir( OUTDIR ): 124 | os.makedirs( OUTDIR ) 125 | 126 | # 127 | zenith_list = [out.zenith for out in grid.output_angles] 128 | SWdirect_list = [out.SWdirect for out in grid.output_angles] 129 | SWminus_list = [out.SWminus for out in grid.output_angles] 130 | SWplus_list = [out.SWplus for out in grid.output_angles] 131 | 132 | pyrads.Write_Data.save_profile(OUTDIR,grid.n0,grid.n1,grid.dn, \ 133 | grid.p,grid.T,grid.q, \ 134 | zenith_list,SWdirect_list,SWminus_list,SWplus_list ) 135 | 136 | 137 | 138 | ## Finally, allow main() to be called from command line: 139 | ## USAGE: 140 | ## python compute_sw_h2o.py 1000. 1100. 0.01 300. dir_output 141 | 142 | if __name__ == "__main__": 143 | n0 = float(sys.argv[1]) 144 | n1 = float(sys.argv[2]) 145 | dn = float(sys.argv[3]) 146 | Ts = float(sys.argv[4]) 147 | outdir = sys.argv[5] 148 | main(n0,n1,dn,Ts,OUTDIR=outdir) 149 | 150 | 151 | -------------------------------------------------------------------------------- /Test04.sw_full_spectrum/compute_sw_h2o.py: -------------------------------------------------------------------------------- 1 | from __future__ import division, print_function 2 | import numpy as np 3 | import sys,os 4 | 5 | sys.path.append("..") 6 | import pyrads 7 | 8 | from scipy.integrate import trapz,simps,cumtrapz 9 | import time 10 | 11 | ### ----------------------------------- 12 | ### Helpers 13 | class Dummy: 14 | pass 15 | 16 | 17 | ### ----------------------------------- 18 | 19 | # --- 20 | ## setup thermodynamic parameters 21 | params = Dummy() 22 | 23 | params.Rv = pyrads.phys.H2O.R # moist component 24 | params.cpv = pyrads.phys.H2O.cp 25 | params.Lvap = pyrads.phys.H2O.L_vaporization_TriplePoint 26 | params.satvap_T0 = pyrads.phys.H2O.TriplePointT 27 | params.satvap_e0 = pyrads.phys.H2O.TriplePointP 28 | params.esat = lambda T: pyrads.Thermodynamics.get_satvps(T,params.satvap_T0,params.satvap_e0,params.Rv,params.Lvap) 29 | 30 | params.R = pyrads.phys.air.R # dry component 31 | params.cp = pyrads.phys.air.cp 32 | params.ps_dry = 1e5 # surface pressure of dry component 33 | 34 | params.g = 9.8 # surface gravity 35 | params.cosThetaBar = 3./5. # average zenith angle used in 2stream eqns 36 | params.RH = 1. # relative humidity 37 | 38 | 39 | ## scattering parameters: 40 | params.Lstar = 1365. # ... 41 | params.alpha_surf = 0.12 # surface albedo 42 | 43 | params.Tstar = 5800. 44 | params.sourceFn = lambda wave: np.pi * pyrads.Planck.Planck_n(wave,params.Tstar) * \ 45 | (params.Lstar)/(pyrads.phys.sigma* params.Tstar**4) # units = W/m2/cm^-1 46 | 47 | params.zenith_list = np.array([7.5,22.5,37.5,52.5,67.5,82.5]) # angles for scattering? 48 | 49 | ## other parameters: 50 | params.Tstrat = 150. 51 | 52 | ## numerical parameters: 53 | params.N_press = 15 # MAKE SURE THIS IS AN 'INT'! -- chosen low res for testing only! 54 | params.RH = 1. 55 | 56 | 57 | 58 | ### ----------------------------------- 59 | ### Main 60 | 61 | def main(wavenr_min,wavenr_max,dwavenr,Ts,OUTDIR='./'): 62 | print( "Ts, wavenr_min, wavenr_max, dwave = ", Ts,wavenr_min,wavenr_max,dwavenr ) 63 | 64 | 65 | # ---- 66 | # setup grid: 67 | grid = pyrads.SetupGrids.make_grid( Ts,params.Tstrat,params.N_press, \ 68 | wavenr_min,wavenr_max,dwavenr, \ 69 | params, pTOA_decade=-4, RH=params.RH ) 70 | 71 | 72 | # ---- 73 | # compute optical thickness: 74 | print( "Compute tau, omega... " ) 75 | grid.tau,grid.omega = pyrads.OpticalThickness.compute_tau_omega_H2ON2(grid.p,grid.T,grid.q,grid,params, RH=params.RH ) 76 | print( "Done " ) 77 | 78 | # --- 79 | # compute SW fluxes 80 | # run pyDISORT over all zenith angles -> this can get long! 81 | 82 | grid.output_angles = [] 83 | 84 | start01 = time.time() # TESTING 85 | for zenith in params.zenith_list: 86 | print( "\n---" ) 87 | print( "\nZenith angle = ", zenith ) 88 | 89 | cosz = np.cos( zenith * np.pi/180. ) 90 | 91 | # 92 | out = Dummy() 93 | out.zenith = zenith 94 | out.cosz = cosz 95 | 96 | # run pyDISORT 97 | SWdirect_spec,SWplus_spec,SWminus_spec = pyrads.Get_Fluxes_pyDISORT.get_fluxes( \ 98 | grid.p*0.9999, \ 99 | grid.p,grid.T, \ 100 | grid.n, grid.tau, grid.omega, \ 101 | cosz, params.Lstar,params.alpha_surf, \ 102 | N_streams=4,doThermal=False, \ 103 | sourceFn=params.sourceFn ) 104 | 105 | # convert to total fluxes 106 | # output has same units as source fn 107 | # integrate to get W/m2 108 | out.SWdirect = np.trapz( SWdirect_spec,x=grid.n,axis=-1 ) 109 | out.SWplus = np.trapz( SWplus_spec,x=grid.n,axis=-1 ) 110 | out.SWminus = np.trapz( SWminus_spec,x=grid.n,axis=-1 ) 111 | 112 | # 113 | grid.output_angles.append( out ) 114 | 115 | print( "Done! \n" ) 116 | end01 = time.time() # TESTING 117 | print( "***\nTiming for all solar angles: ", end01-start01, "\n***" ) # TESTING 118 | 119 | # --- 120 | # save to file 121 | OUTDIR = OUTDIR + "/" # (make sure to add a '/' at end!!) 122 | print( "Saving output to ",OUTDIR ) 123 | if not os.path.isdir( OUTDIR ): 124 | os.makedirs( OUTDIR ) 125 | 126 | # 127 | zenith_list = [out.zenith for out in grid.output_angles] 128 | SWdirect_list = [out.SWdirect for out in grid.output_angles] 129 | SWminus_list = [out.SWminus for out in grid.output_angles] 130 | SWplus_list = [out.SWplus for out in grid.output_angles] 131 | 132 | pyrads.Write_Data.save_profile(OUTDIR,grid.n0,grid.n1,grid.dn, \ 133 | grid.p,grid.T,grid.q, \ 134 | zenith_list,SWdirect_list,SWminus_list,SWplus_list ) 135 | 136 | 137 | 138 | ## Finally, allow main() to be called from command line: 139 | ## USAGE: 140 | ## python compute_sw_h2o.py 1000. 1100. 0.01 300. dir_output 141 | 142 | if __name__ == "__main__": 143 | n0 = float(sys.argv[1]) 144 | n1 = float(sys.argv[2]) 145 | dn = float(sys.argv[3]) 146 | Ts = float(sys.argv[4]) 147 | outdir = sys.argv[5] 148 | main(n0,n1,dn,Ts,OUTDIR=outdir) 149 | 150 | 151 | -------------------------------------------------------------------------------- /Test04.sw_full_spectrum/merge_spectrum.py: -------------------------------------------------------------------------------- 1 | from __future__ import division, print_function 2 | import numpy as np 3 | import sys,os 4 | 5 | sys.path.append("..") 6 | import pyrads 7 | 8 | from scipy.integrate import trapz,simps,cumtrapz 9 | 10 | ### ----------------------------------- 11 | ### Helpers 12 | class Dummy: 13 | pass 14 | 15 | 16 | ### ----------------------------------- 17 | ### MAIN 18 | 19 | output_angles = pyrads.Merge_Spectral_Output.merge_output(".",prefix='output') 20 | 21 | # COMPUTE ANGLE-AVERAGED QUANTITIES 22 | Nangles = len(output_angles) 23 | 24 | # if Nangles != 6: 25 | # print( "*** ERROR: number of angles doesn't match the expected value!! ***" ) 26 | 27 | ## --- 28 | SWdir_angular = np.zeros( (len(output_angles[0].SWdir),Nangles) ) 29 | SWdn_angular = np.zeros( (len(output_angles[0].SWdir),Nangles) ) 30 | SWup_angular = np.zeros( (len(output_angles[0].SWdir),Nangles) ) 31 | LWdn_angular = np.zeros( (len(output_angles[0].SWdir),Nangles) ) 32 | LWup_angular = np.zeros( (len(output_angles[0].SWdir),Nangles) ) 33 | albedo_angular = np.zeros( Nangles ) 34 | 35 | zenith_angular = [angle.zenith for angle in output_angles] 36 | cosz_angular = [angle.cosz for angle in output_angles] 37 | 38 | for angle,i in zip(output_angles,range(Nangles)): 39 | SWdir_angular[:,i] = angle.SWdir 40 | SWdn_angular[:,i] = angle.SWdn 41 | SWup_angular[:,i] = angle.SWup 42 | 43 | # FOR NOW: skip LW, not implemented yet... 44 | # LWdn_angular[:,i] = angle.LWdn 45 | # LWup_angular[:,i] = angle.LWup 46 | 47 | albedo_angular[i] = angle.SWup[0]/(angle.SWdir[0]+angle.SWdn[0]) 48 | 49 | # average over angles, using correct weights: 50 | weight = np.sin( np.array(zenith_angular) * np.pi/180. ) 51 | 52 | SWdir = np.average( SWdir_angular,axis=-1,weights=weight ) 53 | SWdn = np.average( SWdn_angular,axis=-1,weights=weight ) 54 | SWup = np.average( SWup_angular,axis=-1,weights=weight ) 55 | LWdn = np.average( LWdn_angular,axis=-1,weights=weight ) 56 | LWup = np.average( LWup_angular,axis=-1,weights=weight ) 57 | albedo = np.average( albedo_angular,axis=-1,weights=weight ) 58 | 59 | 60 | print( "zenith angles", zenith_angular ) 61 | print( "albedo at each angle", albedo_angular ) 62 | print( "average albedo", albedo ) 63 | -------------------------------------------------------------------------------- /Test04.sw_full_spectrum/output_nA1000.0_nB10000.0_dn1.00e+00.txt: -------------------------------------------------------------------------------- 1 | wavenr_min,wavenr_max,dwave [cm^-1] = 1000.0000,10000.0000,1.0000 2 | zenith angle = 7.5000 3 | pressure [bar], Temperature [K], Specific Humidity[-], dir SW flux [W/m2], dn SW flux [W/m2], up SW flux [W/m2] 4 | 1.035813e-04, 1.500000e+02, 1.425940e-09, 3.777112e+02, 1.840107e-04, 1.631682e+01 5 | 1.999843e-04, 1.500000e+02, 1.425940e-09, 3.777112e+02, 1.840107e-04, 1.631682e+01 6 | 3.861092e-04, 1.500000e+02, 1.425940e-09, 3.776535e+02, 5.455583e-05, 1.631681e+01 7 | 7.454601e-04, 1.500000e+02, 1.425940e-09, 3.776250e+02, -4.403898e-05, 1.631676e+01 8 | 1.439258e-03, 1.500000e+02, 1.425940e-09, 3.775965e+02, 9.526650e-05, 1.631665e+01 9 | 2.778772e-03, 1.500000e+02, 1.425940e-09, 3.775677e+02, 8.314289e-04, 1.631627e+01 10 | 5.364970e-03, 1.500000e+02, 1.425940e-09, 3.775378e+02, 2.108548e-03, 1.631493e+01 11 | 1.035813e-02, 1.500000e+02, 1.425940e-09, 3.775056e+02, 4.849019e-03, 1.631239e+01 12 | 1.999843e-02, 1.500000e+02, 1.425940e-09, 3.774687e+02, 1.035795e-02, 1.630745e+01 13 | 3.861092e-02, 1.500000e+02, 1.425940e-09, 3.774221e+02, 2.091602e-02, 1.629779e+01 14 | 7.454601e-02, 1.722863e+02, 4.821933e-07, 3.752238e+02, 6.891814e-02, 1.625402e+01 15 | 1.439258e-01, 2.077983e+02, 5.278743e-05, 3.479359e+02, 1.986915e-01, 1.610953e+01 16 | 2.778772e-01, 2.466323e+02, 1.634240e-03, 2.821777e+02, 3.139150e-01, 1.593192e+01 17 | 5.364970e-01, 2.769088e+02, 9.305363e-03, 2.146771e+02, 3.354062e-01, 1.615395e+01 18 | 1.035813e+00, 3.000000e+02, 2.176769e-02, 1.603702e+02, 4.197493e-01, 1.929178e+01 19 | 20 | 21 | wavenr_min,wavenr_max,dwave [cm^-1] = 1000.0000,10000.0000,1.0000 22 | zenith angle = 22.5000 23 | pressure [bar], Temperature [K], Specific Humidity[-], dir SW flux [W/m2], dn SW flux [W/m2], up SW flux [W/m2] 24 | 1.035813e-04, 1.500000e+02, 1.425940e-09, 3.519708e+02, 2.595257e-04, 1.515384e+01 25 | 1.999843e-04, 1.500000e+02, 1.425940e-09, 3.519708e+02, 2.595257e-04, 1.515384e+01 26 | 3.861092e-04, 1.500000e+02, 1.425940e-09, 3.519132e+02, 1.379864e-04, 1.515384e+01 27 | 7.454601e-04, 1.500000e+02, 1.425940e-09, 3.518847e+02, -2.867891e-05, 1.515376e+01 28 | 1.439258e-03, 1.500000e+02, 1.425940e-09, 3.518563e+02, 5.243823e-05, 1.515362e+01 29 | 2.778772e-03, 1.500000e+02, 1.425940e-09, 3.518276e+02, 8.300644e-04, 1.515319e+01 30 | 5.364970e-03, 1.500000e+02, 1.425940e-09, 3.517979e+02, 2.187222e-03, 1.515186e+01 31 | 1.035813e-02, 1.500000e+02, 1.425940e-09, 3.517658e+02, 4.944198e-03, 1.514929e+01 32 | 1.999843e-02, 1.500000e+02, 1.425940e-09, 3.517291e+02, 1.034293e-02, 1.514427e+01 33 | 3.861092e-02, 1.500000e+02, 1.425940e-09, 3.516828e+02, 2.087093e-02, 1.513458e+01 34 | 7.454601e-02, 1.722863e+02, 4.821933e-07, 3.495386e+02, 6.886528e-02, 1.509090e+01 35 | 1.439258e-01, 2.077983e+02, 5.278743e-05, 3.235087e+02, 1.971435e-01, 1.494677e+01 36 | 2.778772e-01, 2.466323e+02, 1.634240e-03, 2.614249e+02, 3.107490e-01, 1.476755e+01 37 | 5.364970e-01, 2.769088e+02, 9.305363e-03, 1.981003e+02, 3.305758e-01, 1.495650e+01 38 | 1.035813e+00, 3.000000e+02, 2.176769e-02, 1.474355e+02, 4.124357e-01, 1.773913e+01 39 | 40 | 41 | wavenr_min,wavenr_max,dwave [cm^-1] = 1000.0000,10000.0000,1.0000 42 | zenith angle = 37.5000 43 | pressure [bar], Temperature [K], Specific Humidity[-], dir SW flux [W/m2], dn SW flux [W/m2], up SW flux [W/m2] 44 | 1.035813e-04, 1.500000e+02, 1.425940e-09, 3.022442e+02, 1.787245e-04, 1.291657e+01 45 | 1.999843e-04, 1.500000e+02, 1.425940e-09, 3.022442e+02, 1.787245e-04, 1.291657e+01 46 | 3.861092e-04, 1.500000e+02, 1.425940e-09, 3.021867e+02, 1.862021e-04, 1.291654e+01 47 | 7.454601e-04, 1.500000e+02, 1.425940e-09, 3.021584e+02, 1.811155e-05, 1.291646e+01 48 | 1.439258e-03, 1.500000e+02, 1.425940e-09, 3.021302e+02, 2.975514e-04, 1.291626e+01 49 | 2.778772e-03, 1.500000e+02, 1.425940e-09, 3.021018e+02, 1.015266e-03, 1.291578e+01 50 | 5.364970e-03, 1.500000e+02, 1.425940e-09, 3.020724e+02, 2.457673e-03, 1.291437e+01 51 | 1.035813e-02, 1.500000e+02, 1.425940e-09, 3.020408e+02, 5.035870e-03, 1.291166e+01 52 | 1.999843e-02, 1.500000e+02, 1.425940e-09, 3.020044e+02, 1.036867e-02, 1.290655e+01 53 | 3.861092e-02, 1.500000e+02, 1.425940e-09, 3.019586e+02, 2.108497e-02, 1.289697e+01 54 | 7.454601e-02, 1.722863e+02, 4.821933e-07, 2.999305e+02, 6.833618e-02, 1.285285e+01 55 | 1.439258e-01, 2.077983e+02, 5.278743e-05, 2.764447e+02, 1.945795e-01, 1.270941e+01 56 | 2.778772e-01, 2.466323e+02, 1.634240e-03, 2.216200e+02, 3.046007e-01, 1.252734e+01 57 | 5.364970e-01, 2.769088e+02, 9.305363e-03, 1.664914e+02, 3.213197e-01, 1.265434e+01 58 | 1.035813e+00, 3.000000e+02, 2.176769e-02, 1.228833e+02, 3.981854e-01, 1.479185e+01 59 | 60 | 61 | wavenr_min,wavenr_max,dwave [cm^-1] = 1000.0000,10000.0000,1.0000 62 | zenith angle = 52.5000 63 | pressure [bar], Temperature [K], Specific Humidity[-], dir SW flux [W/m2], dn SW flux [W/m2], up SW flux [W/m2] 64 | 1.035813e-04, 1.500000e+02, 1.425940e-09, 2.319201e+02, 1.183819e-04, 9.779313e+00 65 | 1.999843e-04, 1.500000e+02, 1.425940e-09, 2.319201e+02, 1.183819e-04, 9.779313e+00 66 | 3.861092e-04, 1.500000e+02, 1.425940e-09, 2.318629e+02, 1.230807e-04, 9.779258e+00 67 | 7.454601e-04, 1.500000e+02, 1.425940e-09, 2.318350e+02, 1.188421e-04, 9.779153e+00 68 | 1.439258e-03, 1.500000e+02, 1.425940e-09, 2.318073e+02, 3.380070e-04, 9.778915e+00 69 | 2.778772e-03, 1.500000e+02, 1.425940e-09, 2.317794e+02, 1.147110e-03, 9.778409e+00 70 | 5.364970e-03, 1.500000e+02, 1.425940e-09, 2.317507e+02, 2.407108e-03, 9.776940e+00 71 | 1.035813e-02, 1.500000e+02, 1.425940e-09, 2.317199e+02, 5.155481e-03, 9.774228e+00 72 | 1.999843e-02, 1.500000e+02, 1.425940e-09, 2.316844e+02, 1.068360e-02, 9.769217e+00 73 | 3.861092e-02, 1.500000e+02, 1.425940e-09, 2.316395e+02, 2.124013e-02, 9.759312e+00 74 | 7.454601e-02, 1.722863e+02, 4.821933e-07, 2.298080e+02, 6.797552e-02, 9.715085e+00 75 | 1.439258e-01, 2.077983e+02, 5.278743e-05, 2.102329e+02, 1.907798e-01, 9.572795e+00 76 | 2.778772e-01, 2.466323e+02, 1.634240e-03, 1.661078e+02, 2.954254e-01, 9.387595e+00 77 | 5.364970e-01, 2.769088e+02, 9.305363e-03, 1.228943e+02, 3.082700e-01, 9.432683e+00 78 | 1.035813e+00, 3.000000e+02, 2.176769e-02, 8.929806e+01, 3.779183e-01, 1.075997e+01 79 | 80 | 81 | wavenr_min,wavenr_max,dwave [cm^-1] = 1000.0000,10000.0000,1.0000 82 | zenith angle = 67.5000 83 | pressure [bar], Temperature [K], Specific Humidity[-], dir SW flux [W/m2], dn SW flux [W/m2], up SW flux [W/m2] 84 | 1.035813e-04, 1.500000e+02, 1.425940e-09, 1.457911e+02, 5.811796e-05, 6.009598e+00 85 | 1.999843e-04, 1.500000e+02, 1.425940e-09, 1.457911e+02, 5.811796e-05, 6.009598e+00 86 | 3.861092e-04, 1.500000e+02, 1.425940e-09, 1.457346e+02, 1.371847e-04, 6.009528e+00 87 | 7.454601e-04, 1.500000e+02, 1.425940e-09, 1.457075e+02, 2.004035e-04, 6.009388e+00 88 | 1.439258e-03, 1.500000e+02, 1.425940e-09, 1.456809e+02, 4.616038e-04, 6.009106e+00 89 | 2.778772e-03, 1.500000e+02, 1.425940e-09, 1.456545e+02, 1.218866e-03, 6.008512e+00 90 | 5.364970e-03, 1.500000e+02, 1.425940e-09, 1.456274e+02, 2.575292e-03, 6.007097e+00 91 | 1.035813e-02, 1.500000e+02, 1.425940e-09, 1.455983e+02, 5.295924e-03, 6.004424e+00 92 | 1.999843e-02, 1.500000e+02, 1.425940e-09, 1.455649e+02, 1.073884e-02, 5.999268e+00 93 | 3.861092e-02, 1.500000e+02, 1.425940e-09, 1.455221e+02, 2.120955e-02, 5.989322e+00 94 | 7.454601e-02, 1.722863e+02, 4.821933e-07, 1.440114e+02, 6.710696e-02, 5.945096e+00 95 | 1.439258e-01, 2.077983e+02, 5.278743e-05, 1.299204e+02, 1.847951e-01, 5.805660e+00 96 | 2.778772e-01, 2.466323e+02, 1.634240e-03, 9.986422e+01, 2.819779e-01, 5.619878e+00 97 | 5.364970e-01, 2.769088e+02, 9.305363e-03, 7.186951e+01, 2.911589e-01, 5.578533e+00 98 | 1.035813e+00, 3.000000e+02, 2.176769e-02, 5.053721e+01, 3.511599e-01, 6.106156e+00 99 | 100 | 101 | wavenr_min,wavenr_max,dwave [cm^-1] = 1000.0000,10000.0000,1.0000 102 | zenith angle = 82.5000 103 | pressure [bar], Temperature [K], Specific Humidity[-], dir SW flux [W/m2], dn SW flux [W/m2], up SW flux [W/m2] 104 | 1.035813e-04, 1.500000e+02, 1.425940e-09, 4.972662e+01, 2.478393e-05, 2.036874e+00 105 | 1.999843e-04, 1.500000e+02, 1.425940e-09, 4.972662e+01, 2.478393e-05, 2.036874e+00 106 | 3.861092e-04, 1.500000e+02, 1.425940e-09, 4.967357e+01, 1.602347e-04, 2.036765e+00 107 | 7.454601e-04, 1.500000e+02, 1.425940e-09, 4.965020e+01, 3.010112e-04, 2.036598e+00 108 | 1.439258e-03, 1.500000e+02, 1.425940e-09, 4.962824e+01, 6.425321e-04, 2.036256e+00 109 | 2.778772e-03, 1.500000e+02, 1.425940e-09, 4.960708e+01, 1.416045e-03, 2.035583e+00 110 | 5.364970e-03, 1.500000e+02, 1.425940e-09, 4.958583e+01, 2.826646e-03, 2.034156e+00 111 | 1.035813e-02, 1.500000e+02, 1.425940e-09, 4.956304e+01, 5.575961e-03, 2.031442e+00 112 | 1.999843e-02, 1.500000e+02, 1.425940e-09, 4.953608e+01, 1.094284e-02, 2.026221e+00 113 | 3.861092e-02, 1.500000e+02, 1.425940e-09, 4.950007e+01, 2.131335e-02, 2.016092e+00 114 | 7.454601e-02, 1.722863e+02, 4.821933e-07, 4.858785e+01, 6.487510e-02, 1.973024e+00 115 | 1.439258e-01, 2.077983e+02, 5.278743e-05, 4.223828e+01, 1.701310e-01, 1.844853e+00 116 | 2.778772e-01, 2.466323e+02, 1.634240e-03, 3.018640e+01, 2.525621e-01, 1.675263e+00 117 | 5.364970e-01, 2.769088e+02, 9.305363e-03, 2.023443e+01, 2.616829e-01, 1.574941e+00 118 | 1.035813e+00, 3.000000e+02, 2.176769e-02, 1.258614e+01, 3.055597e-01, 1.546970e+00 119 | 120 | 121 | -------------------------------------------------------------------------------- /Test04.sw_full_spectrum/output_nA10000.0_nB20000.0_dn1.00e+00.txt: -------------------------------------------------------------------------------- 1 | wavenr_min,wavenr_max,dwave [cm^-1] = 10000.0000,20000.0000,1.0000 2 | zenith angle = 7.5000 3 | pressure [bar], Temperature [K], Specific Humidity[-], dir SW flux [W/m2], dn SW flux [W/m2], up SW flux [W/m2] 4 | 1.035813e-04, 1.500000e+02, 1.425940e-09, 6.354354e+02, 6.980343e-03, 6.371645e+01 5 | 1.999843e-04, 1.500000e+02, 1.425940e-09, 6.354354e+02, 6.980343e-03, 6.371645e+01 6 | 3.861092e-04, 1.500000e+02, 1.425940e-09, 6.354266e+02, 1.003610e-02, 6.371527e+01 7 | 7.454601e-04, 1.500000e+02, 1.425940e-09, 6.354154e+02, 1.138718e-02, 6.371010e+01 8 | 1.439258e-03, 1.500000e+02, 1.425940e-09, 6.353939e+02, 2.001009e-02, 6.370018e+01 9 | 2.778772e-03, 1.500000e+02, 1.425940e-09, 6.353522e+02, 3.966516e-02, 6.368076e+01 10 | 5.364970e-03, 1.500000e+02, 1.425940e-09, 6.352718e+02, 8.475813e-02, 6.364852e+01 11 | 1.035813e-02, 1.500000e+02, 1.425940e-09, 6.351165e+02, 1.769337e-01, 6.358976e+01 12 | 1.999843e-02, 1.500000e+02, 1.425940e-09, 6.348168e+02, 3.631370e-01, 6.347740e+01 13 | 3.861092e-02, 1.500000e+02, 1.425940e-09, 6.342390e+02, 7.237571e-01, 6.326077e+01 14 | 7.454601e-02, 1.722863e+02, 4.821933e-07, 6.331051e+02, 1.419609e+00, 6.283755e+01 15 | 1.439258e-01, 2.077983e+02, 5.278743e-05, 6.286784e+02, 2.866646e+00, 6.189807e+01 16 | 2.778772e-01, 2.466323e+02, 1.634240e-03, 5.980991e+02, 5.646774e+00, 5.998526e+01 17 | 5.364970e-01, 2.769088e+02, 9.305363e-03, 5.397503e+02, 9.713950e+00, 5.782180e+01 18 | 1.035813e+00, 3.000000e+02, 2.176769e-02, 4.664267e+02, 1.602848e+01, 5.789113e+01 19 | 20 | 21 | wavenr_min,wavenr_max,dwave [cm^-1] = 10000.0000,20000.0000,1.0000 22 | zenith angle = 22.5000 23 | pressure [bar], Temperature [K], Specific Humidity[-], dir SW flux [W/m2], dn SW flux [W/m2], up SW flux [W/m2] 24 | 1.035813e-04, 1.500000e+02, 1.425940e-09, 5.921315e+02, 6.490562e-03, 6.005500e+01 25 | 1.999843e-04, 1.500000e+02, 1.425940e-09, 5.921315e+02, 6.490562e-03, 6.005500e+01 26 | 3.861092e-04, 1.500000e+02, 1.425940e-09, 5.921227e+02, 9.423634e-03, 6.005349e+01 27 | 7.454601e-04, 1.500000e+02, 1.425940e-09, 5.921115e+02, 1.119460e-02, 6.004812e+01 28 | 1.439258e-03, 1.500000e+02, 1.425940e-09, 5.920900e+02, 2.008895e-02, 6.003872e+01 29 | 2.778772e-03, 1.500000e+02, 1.425940e-09, 5.920483e+02, 4.029439e-02, 6.001978e+01 30 | 5.364970e-03, 1.500000e+02, 1.425940e-09, 5.919679e+02, 8.572737e-02, 5.998756e+01 31 | 1.035813e-02, 1.500000e+02, 1.425940e-09, 5.918126e+02, 1.767146e-01, 5.992713e+01 32 | 1.999843e-02, 1.500000e+02, 1.425940e-09, 5.915130e+02, 3.612524e-01, 5.981358e+01 33 | 3.861092e-02, 1.500000e+02, 1.425940e-09, 5.909353e+02, 7.192405e-01, 5.959456e+01 34 | 7.454601e-02, 1.722863e+02, 4.821933e-07, 5.898017e+02, 1.409254e+00, 5.916547e+01 35 | 1.439258e-01, 2.077983e+02, 5.278743e-05, 5.854004e+02, 2.843384e+00, 5.821546e+01 36 | 2.778772e-01, 2.466323e+02, 1.634240e-03, 5.557478e+02, 5.591586e+00, 5.627847e+01 37 | 5.364970e-01, 2.769088e+02, 9.305363e-03, 4.998237e+02, 9.581516e+00, 5.400273e+01 38 | 1.035813e+00, 3.000000e+02, 2.176769e-02, 4.296819e+02, 1.575016e+01, 5.344877e+01 39 | 40 | 41 | wavenr_min,wavenr_max,dwave [cm^-1] = 10000.0000,20000.0000,1.0000 42 | zenith angle = 37.5000 43 | pressure [bar], Temperature [K], Specific Humidity[-], dir SW flux [W/m2], dn SW flux [W/m2], up SW flux [W/m2] 44 | 1.035813e-04, 1.500000e+02, 1.425940e-09, 5.084749e+02, 5.380405e-03, 5.298262e+01 45 | 1.999843e-04, 1.500000e+02, 1.425940e-09, 5.084749e+02, 5.380405e-03, 5.298262e+01 46 | 3.861092e-04, 1.500000e+02, 1.425940e-09, 5.084661e+02, 8.894512e-03, 5.298070e+01 47 | 7.454601e-04, 1.500000e+02, 1.425940e-09, 5.084549e+02, 1.081116e-02, 5.297499e+01 48 | 1.439258e-03, 1.500000e+02, 1.425940e-09, 5.084333e+02, 2.020783e-02, 5.296560e+01 49 | 2.778772e-03, 1.500000e+02, 1.425940e-09, 5.083917e+02, 4.222111e-02, 5.294813e+01 50 | 5.364970e-03, 1.500000e+02, 1.425940e-09, 5.083112e+02, 8.658371e-02, 5.291484e+01 51 | 1.035813e-02, 1.500000e+02, 1.425940e-09, 5.081560e+02, 1.764937e-01, 5.285308e+01 52 | 1.999843e-02, 1.500000e+02, 1.425940e-09, 5.078564e+02, 3.584746e-01, 5.273632e+01 53 | 3.861092e-02, 1.500000e+02, 1.425940e-09, 5.072789e+02, 7.101901e-01, 5.251136e+01 54 | 7.454601e-02, 1.722863e+02, 4.821933e-07, 5.061462e+02, 1.388235e+00, 5.207114e+01 55 | 1.439258e-01, 2.077983e+02, 5.278743e-05, 5.018036e+02, 2.796575e+00, 5.110064e+01 56 | 2.778772e-01, 2.466323e+02, 1.634240e-03, 4.740860e+02, 5.480656e+00, 4.911788e+01 57 | 5.364970e-01, 2.769088e+02, 9.305363e-03, 4.230463e+02, 9.335428e+00, 4.663318e+01 58 | 1.035813e+00, 3.000000e+02, 2.176769e-02, 3.593506e+02, 1.519817e+01, 4.494353e+01 59 | 60 | 61 | wavenr_min,wavenr_max,dwave [cm^-1] = 10000.0000,20000.0000,1.0000 62 | zenith angle = 52.5000 63 | pressure [bar], Temperature [K], Specific Humidity[-], dir SW flux [W/m2], dn SW flux [W/m2], up SW flux [W/m2] 64 | 1.035813e-04, 1.500000e+02, 1.425940e-09, 3.901665e+02, 4.214778e-03, 4.296928e+01 65 | 1.999843e-04, 1.500000e+02, 1.425940e-09, 3.901665e+02, 4.214778e-03, 4.296928e+01 66 | 3.861092e-04, 1.500000e+02, 1.425940e-09, 3.901577e+02, 8.284315e-03, 4.296717e+01 67 | 7.454601e-04, 1.500000e+02, 1.425940e-09, 3.901465e+02, 1.118680e-02, 4.296160e+01 68 | 1.439258e-03, 1.500000e+02, 1.425940e-09, 3.901249e+02, 2.004791e-02, 4.295104e+01 69 | 2.778772e-03, 1.500000e+02, 1.425940e-09, 3.900833e+02, 4.227384e-02, 4.293307e+01 70 | 5.364970e-03, 1.500000e+02, 1.425940e-09, 3.900029e+02, 8.746564e-02, 4.289994e+01 71 | 1.035813e-02, 1.500000e+02, 1.425940e-09, 3.898477e+02, 1.766579e-01, 4.283632e+01 72 | 1.999843e-02, 1.500000e+02, 1.425940e-09, 3.895482e+02, 3.537661e-01, 4.271474e+01 73 | 3.861092e-02, 1.500000e+02, 1.425940e-09, 3.889712e+02, 6.963028e-01, 4.248097e+01 74 | 7.454601e-02, 1.722863e+02, 4.821933e-07, 3.878403e+02, 1.356252e+00, 4.202437e+01 75 | 1.439258e-01, 2.077983e+02, 5.278743e-05, 3.836112e+02, 2.725425e+00, 4.102487e+01 76 | 2.778772e-01, 2.466323e+02, 1.634240e-03, 3.590433e+02, 5.310780e+00, 3.898169e+01 77 | 5.364970e-01, 2.769088e+02, 9.305363e-03, 3.154719e+02, 8.958334e+00, 3.622581e+01 78 | 1.035813e+00, 3.000000e+02, 2.176769e-02, 2.617484e+02, 1.434573e+01, 3.312990e+01 79 | 80 | 81 | wavenr_min,wavenr_max,dwave [cm^-1] = 10000.0000,20000.0000,1.0000 82 | zenith angle = 67.5000 83 | pressure [bar], Temperature [K], Specific Humidity[-], dir SW flux [W/m2], dn SW flux [W/m2], up SW flux [W/m2] 84 | 1.035813e-04, 1.500000e+02, 1.425940e-09, 2.452689e+02, 2.681608e-03, 3.060326e+01 85 | 1.999843e-04, 1.500000e+02, 1.425940e-09, 2.452689e+02, 2.681608e-03, 3.060326e+01 86 | 3.861092e-04, 1.500000e+02, 1.425940e-09, 2.452601e+02, 6.883069e-03, 3.060040e+01 87 | 7.454601e-04, 1.500000e+02, 1.425940e-09, 2.452489e+02, 1.088619e-02, 3.059496e+01 88 | 1.439258e-03, 1.500000e+02, 1.425940e-09, 2.452274e+02, 2.139375e-02, 3.058525e+01 89 | 2.778772e-03, 1.500000e+02, 1.425940e-09, 2.451857e+02, 4.377722e-02, 3.056703e+01 90 | 5.364970e-03, 1.500000e+02, 1.425940e-09, 2.451053e+02, 8.794892e-02, 3.053210e+01 91 | 1.035813e-02, 1.500000e+02, 1.425940e-09, 2.449502e+02, 1.750361e-01, 3.046567e+01 92 | 1.999843e-02, 1.500000e+02, 1.425940e-09, 2.446511e+02, 3.465675e-01, 3.033857e+01 93 | 3.861092e-02, 1.500000e+02, 1.425940e-09, 2.440753e+02, 6.766845e-01, 3.009343e+01 94 | 7.454601e-02, 1.722863e+02, 4.821933e-07, 2.429489e+02, 1.311765e+00, 2.961630e+01 95 | 1.439258e-01, 2.077983e+02, 5.278743e-05, 2.389508e+02, 2.623438e+00, 2.858325e+01 96 | 2.778772e-01, 2.466323e+02, 1.634240e-03, 2.192294e+02, 5.058746e+00, 2.648608e+01 97 | 5.364970e-01, 2.769088e+02, 9.305363e-03, 1.861669e+02, 8.387837e+00, 2.348191e+01 98 | 1.035813e+00, 3.000000e+02, 2.176769e-02, 1.467396e+02, 1.302294e+01, 1.917096e+01 99 | 100 | 101 | wavenr_min,wavenr_max,dwave [cm^-1] = 10000.0000,20000.0000,1.0000 102 | zenith angle = 82.5000 103 | pressure [bar], Temperature [K], Specific Humidity[-], dir SW flux [W/m2], dn SW flux [W/m2], up SW flux [W/m2] 104 | 1.035813e-04, 1.500000e+02, 1.425940e-09, 8.365665e+01, 8.527227e-04, 1.575002e+01 105 | 1.999843e-04, 1.500000e+02, 1.425940e-09, 8.365665e+01, 8.527227e-04, 1.575002e+01 106 | 3.861092e-04, 1.500000e+02, 1.425940e-09, 8.364787e+01, 5.373698e-03, 1.574630e+01 107 | 7.454601e-04, 1.500000e+02, 1.425940e-09, 8.363669e+01, 1.079247e-02, 1.574111e+01 108 | 1.439258e-03, 1.500000e+02, 1.425940e-09, 8.361512e+01, 2.203156e-02, 1.573112e+01 109 | 2.778772e-03, 1.500000e+02, 1.425940e-09, 8.357351e+01, 4.402384e-02, 1.571178e+01 110 | 5.364970e-03, 1.500000e+02, 1.425940e-09, 8.349325e+01, 8.723680e-02, 1.567511e+01 111 | 1.035813e-02, 1.500000e+02, 1.425940e-09, 8.333857e+01, 1.711127e-01, 1.560484e+01 112 | 1.999843e-02, 1.500000e+02, 1.425940e-09, 8.304113e+01, 3.331671e-01, 1.546973e+01 113 | 3.861092e-02, 1.500000e+02, 1.425940e-09, 8.247161e+01, 6.430953e-01, 1.521039e+01 114 | 7.454601e-02, 1.722863e+02, 4.821933e-07, 8.136866e+01, 1.233179e+00, 1.471126e+01 115 | 1.439258e-01, 2.077983e+02, 5.278743e-05, 7.800174e+01, 2.423279e+00, 1.366787e+01 116 | 2.778772e-01, 2.466323e+02, 1.634240e-03, 6.644202e+01, 4.498993e+00, 1.166146e+01 117 | 5.364970e-01, 2.769088e+02, 9.305363e-03, 4.943099e+01, 7.031545e+00, 8.864411e+00 118 | 1.035813e+00, 3.000000e+02, 2.176769e-02, 3.201772e+01, 9.809192e+00, 5.019188e+00 119 | 120 | 121 | -------------------------------------------------------------------------------- /Test04.sw_full_spectrum/output_nA20000.0_nB30000.0_dn1.00e+00.txt: -------------------------------------------------------------------------------- 1 | wavenr_min,wavenr_max,dwave [cm^-1] = 20000.0000,30000.0000,1.0000 2 | zenith angle = 7.5000 3 | pressure [bar], Temperature [K], Specific Humidity[-], dir SW flux [W/m2], dn SW flux [W/m2], up SW flux [W/m2] 4 | 1.035813e-04, 1.500000e+02, 1.425940e-09, 2.622338e+02, 5.187769e-04, 5.893431e+01 5 | 1.999843e-04, 1.500000e+02, 1.425940e-09, 2.622338e+02, 5.187769e-04, 5.893431e+01 6 | 3.861092e-04, 1.500000e+02, 1.425940e-09, 2.622094e+02, 1.580864e-02, 5.892599e+01 7 | 7.454601e-04, 1.500000e+02, 1.425940e-09, 2.621784e+02, 3.823550e-02, 5.891865e+01 8 | 1.439258e-03, 1.500000e+02, 1.425940e-09, 2.621186e+02, 8.240197e-02, 5.890433e+01 9 | 2.778772e-03, 1.500000e+02, 1.425940e-09, 2.620032e+02, 1.695541e-01, 5.887696e+01 10 | 5.364970e-03, 1.500000e+02, 1.425940e-09, 2.617806e+02, 3.383180e-01, 5.882403e+01 11 | 1.035813e-02, 1.500000e+02, 1.425940e-09, 2.613514e+02, 6.651560e-01, 5.872231e+01 12 | 1.999843e-02, 1.500000e+02, 1.425940e-09, 2.605252e+02, 1.293114e+00, 5.852407e+01 13 | 3.861092e-02, 1.500000e+02, 1.425940e-09, 2.589394e+02, 2.489700e+00, 5.813405e+01 14 | 7.454601e-02, 1.722863e+02, 4.821933e-07, 2.559113e+02, 4.740839e+00, 5.735659e+01 15 | 1.439258e-01, 2.077983e+02, 5.278743e-05, 2.501881e+02, 8.875232e+00, 5.576864e+01 16 | 2.778772e-01, 2.466323e+02, 1.634240e-03, 2.395644e+02, 1.611495e+01, 5.240812e+01 17 | 5.364970e-01, 2.769088e+02, 9.305363e-03, 2.204904e+02, 2.757967e+01, 4.497085e+01 18 | 1.035813e+00, 3.000000e+02, 2.176769e-02, 1.884993e+02, 4.167806e+01, 2.762152e+01 19 | 20 | 21 | wavenr_min,wavenr_max,dwave [cm^-1] = 20000.0000,30000.0000,1.0000 22 | zenith angle = 22.5000 23 | pressure [bar], Temperature [K], Specific Humidity[-], dir SW flux [W/m2], dn SW flux [W/m2], up SW flux [W/m2] 24 | 1.035813e-04, 1.500000e+02, 1.425940e-09, 2.443629e+02, 2.751146e-04, 5.682605e+01 25 | 1.999843e-04, 1.500000e+02, 1.425940e-09, 2.443629e+02, 2.751146e-04, 5.682605e+01 26 | 3.861092e-04, 1.500000e+02, 1.425940e-09, 2.443386e+02, 1.617721e-02, 5.681835e+01 27 | 7.454601e-04, 1.500000e+02, 1.425940e-09, 2.443076e+02, 3.846246e-02, 5.681090e+01 28 | 1.439258e-03, 1.500000e+02, 1.425940e-09, 2.442478e+02, 8.240263e-02, 5.679627e+01 29 | 2.778772e-03, 1.500000e+02, 1.425940e-09, 2.441324e+02, 1.688557e-01, 5.676819e+01 30 | 5.364970e-03, 1.500000e+02, 1.425940e-09, 2.439098e+02, 3.369040e-01, 5.671452e+01 31 | 1.035813e-02, 1.500000e+02, 1.425940e-09, 2.434807e+02, 6.618061e-01, 5.661085e+01 32 | 1.999843e-02, 1.500000e+02, 1.425940e-09, 2.426549e+02, 1.285584e+00, 5.640886e+01 33 | 3.861092e-02, 1.500000e+02, 1.425940e-09, 2.410704e+02, 2.474058e+00, 5.601213e+01 34 | 7.454601e-02, 1.722863e+02, 4.821933e-07, 2.380475e+02, 4.707210e+00, 5.522184e+01 35 | 1.439258e-01, 2.077983e+02, 5.278743e-05, 2.323427e+02, 8.800360e+00, 5.361107e+01 36 | 2.778772e-01, 2.466323e+02, 1.634240e-03, 2.217843e+02, 1.593885e+01, 5.021445e+01 37 | 5.364970e-01, 2.769088e+02, 9.305363e-03, 2.029321e+02, 2.714897e+01, 4.274222e+01 38 | 1.035813e+00, 3.000000e+02, 2.176769e-02, 1.716312e+02, 4.064879e+01, 2.547384e+01 39 | 40 | 41 | wavenr_min,wavenr_max,dwave [cm^-1] = 20000.0000,30000.0000,1.0000 42 | zenith angle = 37.5000 43 | pressure [bar], Temperature [K], Specific Humidity[-], dir SW flux [W/m2], dn SW flux [W/m2], up SW flux [W/m2] 44 | 1.035813e-04, 1.500000e+02, 1.425940e-09, 2.098392e+02, 4.216181e-04, 5.259167e+01 45 | 1.999843e-04, 1.500000e+02, 1.425940e-09, 2.098392e+02, 4.216181e-04, 5.259167e+01 46 | 3.861092e-04, 1.500000e+02, 1.425940e-09, 2.098149e+02, 1.607484e-02, 5.258367e+01 47 | 7.454601e-04, 1.500000e+02, 1.425940e-09, 2.097839e+02, 3.799215e-02, 5.257563e+01 48 | 1.439258e-03, 1.500000e+02, 1.425940e-09, 2.097241e+02, 8.214916e-02, 5.256101e+01 49 | 2.778772e-03, 1.500000e+02, 1.425940e-09, 2.096087e+02, 1.675637e-01, 5.253166e+01 50 | 5.364970e-03, 1.500000e+02, 1.425940e-09, 2.093862e+02, 3.334024e-01, 5.247564e+01 51 | 1.035813e-02, 1.500000e+02, 1.425940e-09, 2.089573e+02, 6.535429e-01, 5.236746e+01 52 | 1.999843e-02, 1.500000e+02, 1.425940e-09, 2.081324e+02, 1.268236e+00, 5.215712e+01 53 | 3.861092e-02, 1.500000e+02, 1.425940e-09, 2.065513e+02, 2.437228e+00, 5.174445e+01 54 | 7.454601e-02, 1.722863e+02, 4.821933e-07, 2.035405e+02, 4.629060e+00, 5.092513e+01 55 | 1.439258e-01, 2.077983e+02, 5.278743e-05, 1.978800e+02, 8.628184e+00, 4.926464e+01 56 | 2.778772e-01, 2.466323e+02, 1.634240e-03, 1.874774e+02, 1.554030e+01, 4.579678e+01 57 | 5.364970e-01, 2.769088e+02, 9.305363e-03, 1.691474e+02, 2.619638e+01, 3.828815e+01 58 | 1.035813e+00, 3.000000e+02, 2.176769e-02, 1.394382e+02, 3.845601e+01, 2.134752e+01 59 | 60 | 61 | wavenr_min,wavenr_max,dwave [cm^-1] = 20000.0000,30000.0000,1.0000 62 | zenith angle = 52.5000 63 | pressure [bar], Temperature [K], Specific Humidity[-], dir SW flux [W/m2], dn SW flux [W/m2], up SW flux [W/m2] 64 | 1.035813e-04, 1.500000e+02, 1.425940e-09, 1.610153e+02, 4.194241e-04, 4.605609e+01 65 | 1.999843e-04, 1.500000e+02, 1.425940e-09, 1.610153e+02, 4.194241e-04, 4.605609e+01 66 | 3.861092e-04, 1.500000e+02, 1.425940e-09, 1.609909e+02, 1.591802e-02, 4.604774e+01 67 | 7.454601e-04, 1.500000e+02, 1.425940e-09, 1.609600e+02, 3.806391e-02, 4.603965e+01 68 | 1.439258e-03, 1.500000e+02, 1.425940e-09, 1.609002e+02, 8.107319e-02, 4.602354e+01 69 | 2.778772e-03, 1.500000e+02, 1.425940e-09, 1.607848e+02, 1.643451e-01, 4.599198e+01 70 | 5.364970e-03, 1.500000e+02, 1.425940e-09, 1.605624e+02, 3.257975e-01, 4.593152e+01 71 | 1.035813e-02, 1.500000e+02, 1.425940e-09, 1.601341e+02, 6.370650e-01, 4.581488e+01 72 | 1.999843e-02, 1.500000e+02, 1.425940e-09, 1.593111e+02, 1.233579e+00, 4.558845e+01 73 | 3.861092e-02, 1.500000e+02, 1.425940e-09, 1.577371e+02, 2.365595e+00, 4.514602e+01 74 | 7.454601e-02, 1.722863e+02, 4.821933e-07, 1.547523e+02, 4.478714e+00, 4.427404e+01 75 | 1.439258e-01, 2.077983e+02, 5.278743e-05, 1.491853e+02, 8.300450e+00, 4.252950e+01 76 | 2.778772e-01, 2.466323e+02, 1.634240e-03, 1.391076e+02, 1.479296e+01, 3.896607e+01 77 | 5.364970e-01, 2.769088e+02, 9.305363e-03, 1.218392e+02, 2.445889e+01, 3.152021e+01 78 | 1.035813e+00, 3.000000e+02, 2.176769e-02, 9.522105e+01, 3.467978e+01, 1.558828e+01 79 | 80 | 81 | wavenr_min,wavenr_max,dwave [cm^-1] = 20000.0000,30000.0000,1.0000 82 | zenith angle = 67.5000 83 | pressure [bar], Temperature [K], Specific Humidity[-], dir SW flux [W/m2], dn SW flux [W/m2], up SW flux [W/m2] 84 | 1.035813e-04, 1.500000e+02, 1.425940e-09, 1.012184e+02, 2.007231e-04, 3.632884e+01 85 | 1.999843e-04, 1.500000e+02, 1.425940e-09, 1.012184e+02, 2.007231e-04, 3.632884e+01 86 | 3.861092e-04, 1.500000e+02, 1.425940e-09, 1.011941e+02, 1.581347e-02, 3.632032e+01 87 | 7.454601e-04, 1.500000e+02, 1.425940e-09, 1.011631e+02, 3.691696e-02, 3.631089e+01 88 | 1.439258e-03, 1.500000e+02, 1.425940e-09, 1.011034e+02, 7.777837e-02, 3.629237e+01 89 | 2.778772e-03, 1.500000e+02, 1.425940e-09, 1.009881e+02, 1.570226e-01, 3.625668e+01 90 | 5.364970e-03, 1.500000e+02, 1.425940e-09, 1.007660e+02, 3.098934e-01, 3.618781e+01 91 | 1.035813e-02, 1.500000e+02, 1.425940e-09, 1.003390e+02, 6.040212e-01, 3.605510e+01 92 | 1.999843e-02, 1.500000e+02, 1.425940e-09, 9.952090e+01, 1.165663e+00, 3.579862e+01 93 | 3.861092e-02, 1.500000e+02, 1.425940e-09, 9.796470e+01, 2.225531e+00, 3.530211e+01 94 | 7.454601e-02, 1.722863e+02, 4.821933e-07, 9.504481e+01, 4.183488e+00, 3.434006e+01 95 | 1.439258e-01, 2.077983e+02, 5.278743e-05, 8.970678e+01, 7.654007e+00, 3.247323e+01 96 | 2.778772e-01, 2.466323e+02, 1.634240e-03, 8.039923e+01, 1.332334e+01, 2.885510e+01 97 | 5.364970e-01, 2.769088e+02, 9.305363e-03, 6.550308e+01, 2.113295e+01, 2.190767e+01 98 | 1.035813e+00, 3.000000e+02, 2.176769e-02, 4.511093e+01, 2.800978e+01, 8.774600e+00 99 | 100 | 101 | wavenr_min,wavenr_max,dwave [cm^-1] = 20000.0000,30000.0000,1.0000 102 | zenith angle = 82.5000 103 | pressure [bar], Temperature [K], Specific Humidity[-], dir SW flux [W/m2], dn SW flux [W/m2], up SW flux [W/m2] 104 | 1.035813e-04, 1.500000e+02, 1.425940e-09, 3.452373e+01, 4.976621e-05, 1.861571e+01 105 | 1.999843e-04, 1.500000e+02, 1.425940e-09, 3.452373e+01, 4.976621e-05, 1.861571e+01 106 | 3.861092e-04, 1.500000e+02, 1.425940e-09, 3.449938e+01, 1.442779e-02, 1.860580e+01 107 | 7.454601e-04, 1.500000e+02, 1.425940e-09, 3.446844e+01, 3.297148e-02, 1.859352e+01 108 | 1.439258e-03, 1.500000e+02, 1.425940e-09, 3.440879e+01, 6.883359e-02, 1.856983e+01 109 | 2.778772e-03, 1.500000e+02, 1.425940e-09, 3.429401e+01, 1.378672e-01, 1.852415e+01 110 | 5.364970e-03, 1.500000e+02, 1.425940e-09, 3.407374e+01, 2.702998e-01, 1.843639e+01 111 | 1.035813e-02, 1.500000e+02, 1.425940e-09, 3.365341e+01, 5.227423e-01, 1.826855e+01 112 | 1.999843e-02, 1.500000e+02, 1.425940e-09, 3.285997e+01, 9.976000e-01, 1.794997e+01 113 | 3.861092e-02, 1.500000e+02, 1.425940e-09, 3.139280e+01, 1.869404e+00, 1.735456e+01 114 | 7.454601e-02, 1.722863e+02, 4.821933e-07, 2.878353e+01, 3.397492e+00, 1.627334e+01 115 | 1.439258e-01, 2.077983e+02, 5.278743e-05, 2.446530e+01, 5.850265e+00, 1.440839e+01 116 | 2.778772e-01, 2.466323e+02, 1.634240e-03, 1.816776e+01, 9.180525e+00, 1.145598e+01 117 | 5.364970e-01, 2.769088e+02, 9.305363e-03, 1.071697e+01, 1.240915e+01, 7.319148e+00 118 | 1.035813e+00, 3.000000e+02, 2.176769e-02, 4.349174e+00, 1.342028e+01, 2.132362e+00 119 | 120 | 121 | -------------------------------------------------------------------------------- /pyDISORT-master/README.md: -------------------------------------------------------------------------------- 1 | # pyDISORT 2 | 3 | Python wrapper to the DISORT¹ radiative transfer solver. 4 | 5 | (1) K. Stamnes, SC. Tsay, W. Wiscombe and K. Jayaweera, Numerically 6 | stable algorithm for discrete-ordinate-method radiative 7 | transfer in multiple scattering and emitting layered media, 8 | Appl Opt 27 (1988) (12), pp. 2502–2509. 9 | 10 | ## Installation 11 | 12 | Go to the directory where you have checked out the pyDISORT project and run the following command: 13 | 14 | sudo python setup.py install 15 | 16 | ## Documentation 17 | 18 | >>> import disort 19 | >>> help(disort.run) 20 | 21 | performs radiative transfer simulations by means of the DISORT RT solver 22 | 23 | Parameters 24 | ---------- 25 | dTau : array 26 | optical thickness in atmospheric layers 27 | w0 : float, array 28 | single scattering albedo (Default: 1.) 29 | iphas : int, array 30 | scattering phase function type (Default 2). 31 | 1 : Isotropic 32 | 2 : Rayleigh 33 | 3 : Henyey-Greenstein with asymmetry factor GG 34 | 4 : Haze L as specified by Garcia/Siewert 35 | 5 : Cloud C.1 as specified by Garcia/Siewert 36 | gg : float, array 37 | scattering asymmetry parameter (Default: 0.85) 38 | umu0 : float 39 | cosine of solar zenith angle (Default: 1.) 40 | phi0 : float 41 | solar azimuth angle (Default: 0.) 42 | albedo : float 43 | surface albedo (Default: 0.1) 44 | fbeam : float 45 | solar irradiance (Default: 1.) 46 | utau : float, array 47 | optical thickness where to output the RT fields (Default: 0.) 48 | umu : float, array 49 | cosine of viewing zenith angle where to output the RT fields (Default: 1.) 50 | phi : float, array 51 | viewing azimuth angle where to output the RT fields (Default: 0.) 52 | maxmom : int 53 | Max. number of Legendre coefficients. (Default: 299) 54 | Nstr : int 55 | Number of computational polar angles to be used 56 | (= number of 'streams') ( should be even and .GE. 2 ). 57 | (Default: 32) 58 | temp : float, array 59 | LEV = 0 to NLYR, Temperatures (K) of levels. 60 | (Note that temperature is specified at LEVELS 61 | rather than for layers.) Be sure to put top level 62 | temperature in TEMPER(0), not TEMPER(1). Top and 63 | bottom level values do not need to agree with top and 64 | bottom boundary temperatures (i.e. temperature 65 | discontinuities are allowed). (Default: 300.) 66 | wvnmlo, wvnmhi : float 67 | Wavenumbers (inv cm) of spectral interval of interest 68 | ( used only for calculating Planck function ). 69 | Needed only if PLANK is TRUE, or in multiple runs, if 70 | LAMBER is FALSE and BDREF depends on spectral interval. 71 | (Default: wvnmlo=999., wvnmhi=1000.) 72 | UsrTau : logical 73 | = FALSE, Radiant quantities are to be returned 74 | at boundary of every computational layer. 75 | = TRUE, Radiant quantities are to be returned 76 | at user-specified optical depths 77 | (Default: True) 78 | UsrAng : logical 79 | = FALSE, Radiant quantities are to be returned 80 | at computational polar angles. 81 | = TRUE, Radiant quantities are to be returned 82 | at user-specified polar angles. 83 | (Default: True) 84 | ibcnd : int 85 | = 0, General case: boundary conditions any combination of: 86 | * beam illumination from the top ( see FBEAM ) 87 | * isotropic illumination from the top ( see FISOT ) 88 | * thermal emission from the top ( see TEMIS, TTEMP ) 89 | * internal thermal emission sources ( see TEMPER ) 90 | * reflection at the bottom ( see LAMBER, ALBEDO, BDREF ) 91 | * thermal emission from the bottom ( see BTEMP ) 92 | = 1, Return only albedo and transmissivity of the entire 93 | medium vs. incident beam angle; see S2 for details. 94 | (Default: 0) 95 | fisot : float 96 | Intensity of top-boundary isotropic illumination. 97 | [same units as PLKAVG (default W/sq m) if thermal 98 | sources active, otherwise arbitrary units]. 99 | Corresponding incident flux is pi (3.14159...) 100 | times FISOT. 101 | (Default: 0.) 102 | lamber : bool 103 | = TRUE, isotropically reflecting bottom boundary. 104 | = FALSE, bidirectionally reflecting bottom boundary. 105 | (Default: True) 106 | btemp : float 107 | Temperature of bottom boundary (K) (bottom emissivity 108 | is calculated from ALBEDO or function BDREF, so it need 109 | not be specified). Needed only if PLANK is TRUE. 110 | (Default: 300.) 111 | ttemp : float 112 | Temperature of top boundary (K). 113 | Needed only if PLANK is TRUE. 114 | (Default: 300.) 115 | temis : float 116 | Emissivity of top boundary. 117 | Needed only if PLANK is TRUE. 118 | (Default: 1.) 119 | plank : bool 120 | = TRUE, include thermal emission 121 | = FALSE, ignore all thermal emission (saves computer time) 122 | (Default: False) 123 | onlyFl : bool 124 | = TRUE, return fluxes, flux divergences, and mean 125 | intensities. 126 | = FALSE, return fluxes, flux divergences, mean 127 | intensities, AND intensities. 128 | (Default: False) 129 | accur : float 130 | Convergence criterion for azimuthal (Fourier cosine) 131 | series. Will stop when the following occurs twice: 132 | largest term being added is less than ACCUR times 133 | total series sum. (Twice because there are cases where 134 | terms are anomalously small but azimuthal series has 135 | not converged.) Should be between 0 and 0.01 to avoid 136 | risk of serious non-convergence. Has no effect on 137 | problems lacking a beam source, since azimuthal series 138 | has only one term in that case. 139 | (Default: 0.) 140 | PRNT : array(dtype=bool) 141 | Array of LOGICAL print flags causing the following prints 142 | L quantities printed 143 | -- ------------------ 144 | 1 input variables (except PMOM) 145 | 2 fluxes 146 | 3 intensities at user levels and angles 147 | 4 planar transmissivity and planar albedo 148 | as a function solar zenith angle ( IBCND = 1 ) 149 | 5 phase function moments PMOM for each layer 150 | ( only if PRNT(1) = TRUE, and only for layers 151 | with scattering ) 152 | (Default: array([False False False False False])) 153 | 154 | Returns 155 | ------- 156 | ds_fields : list of arrays 157 | [rfldir, rfldn, flup, dfdt, uavg, uu, albmed, trnmed] 158 | 159 | rfldir : Downward Direct 160 | rfldn : Downward Diffuse 161 | flup : Upward Diffuse 162 | dfdt : d(Net Flux) / d(Op Dep) 163 | uu : Intensity 164 | uavg : Mean intensity (including the direct beam) 165 | (Not corrected for delta-M-scaling effects) 166 | albmed : Albedo of the medium as a function of incident 167 | beam angle cosine UMU(IU) (IBCND = 1 case only) 168 | trnmed : Transmissivity of the medium as a function of incident 169 | beam angle cosine UMU(IU) (IBCND = 1 case only) 170 | 171 | Examples 172 | -------- 173 | >>> import disort 174 | >>> D_dir, D_diff, U_up, dFdt, I = disort.run(dTau, ssalb, iphas='Rayleigh') 175 | 176 | ## Examples 177 | 178 | See `test` directory. 179 | 180 | ## TODO 181 | 182 | - The current implementation have the following parameters hardcoded: 183 | 184 | - MXCLY = 50 (Max no. of computational layers) 185 | - MXULV = 50 (Max no. of output levels) 186 | - MXCMU = 48 (Max no. of computation polar angles) 187 | - MXUMU = 10 (Max no. of output polar angles) 188 | - MXPHI = 3 (Max no. of output azimuthal angles) 189 | - MXSQT = 1000 (Max no. of square roots of integers (for LEPOLY)) 190 | 191 | - These parameters are used as dimensions for array allocation. Allocation 192 | should be done dynamically 193 | -------------------------------------------------------------------------------- /pyDISORT-master/Version: -------------------------------------------------------------------------------- 1 | 0.0.1 2 | 3 | -------------------------------------------------------------------------------- /pyDISORT-master/_disort.so.dSYM/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleIdentifier 8 | com.apple.xcode.dsym._disort.so 9 | CFBundleInfoDictionaryVersion 10 | 6.0 11 | CFBundlePackageType 12 | dSYM 13 | CFBundleSignature 14 | ???? 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleVersion 18 | 1 19 | 20 | 21 | -------------------------------------------------------------------------------- /pyDISORT-master/_disort.so.dSYM/Contents/Resources/DWARF/_disort.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielkoll/PyRADS-shortwave/9d86f7dc07bef37f832949a584f0abe2fd3b72c4/pyDISORT-master/_disort.so.dSYM/Contents/Resources/DWARF/_disort.so -------------------------------------------------------------------------------- /pyDISORT-master/build/lib/disort/__version__.py: -------------------------------------------------------------------------------- 1 | __version__ = '0.0.1' 2 | -------------------------------------------------------------------------------- /pyDISORT-master/build/lib/disort/_disort.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielkoll/PyRADS-shortwave/9d86f7dc07bef37f832949a584f0abe2fd3b72c4/pyDISORT-master/build/lib/disort/_disort.so -------------------------------------------------------------------------------- /pyDISORT-master/doc/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | PAPER = 8 | BUILDDIR = build 9 | 10 | # User-friendly check for sphinx-build 11 | ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) 12 | $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) 13 | endif 14 | 15 | # Internal variables. 16 | PAPEROPT_a4 = -D latex_paper_size=a4 17 | PAPEROPT_letter = -D latex_paper_size=letter 18 | ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source 19 | # the i18n builder cannot share the environment and doctrees with the others 20 | I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source 21 | 22 | .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext 23 | 24 | help: 25 | @echo "Please use \`make ' where is one of" 26 | @echo " html to make standalone HTML files" 27 | @echo " dirhtml to make HTML files named index.html in directories" 28 | @echo " singlehtml to make a single large HTML file" 29 | @echo " pickle to make pickle files" 30 | @echo " json to make JSON files" 31 | @echo " htmlhelp to make HTML files and a HTML help project" 32 | @echo " qthelp to make HTML files and a qthelp project" 33 | @echo " devhelp to make HTML files and a Devhelp project" 34 | @echo " epub to make an epub" 35 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" 36 | @echo " latexpdf to make LaTeX files and run them through pdflatex" 37 | @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" 38 | @echo " text to make text files" 39 | @echo " man to make manual pages" 40 | @echo " texinfo to make Texinfo files" 41 | @echo " info to make Texinfo files and run them through makeinfo" 42 | @echo " gettext to make PO message catalogs" 43 | @echo " changes to make an overview of all changed/added/deprecated items" 44 | @echo " xml to make Docutils-native XML files" 45 | @echo " pseudoxml to make pseudoxml-XML files for display purposes" 46 | @echo " linkcheck to check all external links for integrity" 47 | @echo " doctest to run all doctests embedded in the documentation (if enabled)" 48 | 49 | clean: 50 | rm -rf $(BUILDDIR)/* 51 | 52 | html: 53 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 54 | @echo 55 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." 56 | 57 | dirhtml: 58 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml 59 | @echo 60 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." 61 | 62 | singlehtml: 63 | $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml 64 | @echo 65 | @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." 66 | 67 | pickle: 68 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle 69 | @echo 70 | @echo "Build finished; now you can process the pickle files." 71 | 72 | json: 73 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json 74 | @echo 75 | @echo "Build finished; now you can process the JSON files." 76 | 77 | htmlhelp: 78 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp 79 | @echo 80 | @echo "Build finished; now you can run HTML Help Workshop with the" \ 81 | ".hhp project file in $(BUILDDIR)/htmlhelp." 82 | 83 | qthelp: 84 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp 85 | @echo 86 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \ 87 | ".qhcp project file in $(BUILDDIR)/qthelp, like this:" 88 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/pyDISORT.qhcp" 89 | @echo "To view the help file:" 90 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/pyDISORT.qhc" 91 | 92 | devhelp: 93 | $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp 94 | @echo 95 | @echo "Build finished." 96 | @echo "To view the help file:" 97 | @echo "# mkdir -p $$HOME/.local/share/devhelp/pyDISORT" 98 | @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/pyDISORT" 99 | @echo "# devhelp" 100 | 101 | epub: 102 | $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub 103 | @echo 104 | @echo "Build finished. The epub file is in $(BUILDDIR)/epub." 105 | 106 | latex: 107 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 108 | @echo 109 | @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." 110 | @echo "Run \`make' in that directory to run these through (pdf)latex" \ 111 | "(use \`make latexpdf' here to do that automatically)." 112 | 113 | latexpdf: 114 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 115 | @echo "Running LaTeX files through pdflatex..." 116 | $(MAKE) -C $(BUILDDIR)/latex all-pdf 117 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 118 | 119 | latexpdfja: 120 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 121 | @echo "Running LaTeX files through platex and dvipdfmx..." 122 | $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja 123 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 124 | 125 | text: 126 | $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text 127 | @echo 128 | @echo "Build finished. The text files are in $(BUILDDIR)/text." 129 | 130 | man: 131 | $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man 132 | @echo 133 | @echo "Build finished. The manual pages are in $(BUILDDIR)/man." 134 | 135 | texinfo: 136 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 137 | @echo 138 | @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." 139 | @echo "Run \`make' in that directory to run these through makeinfo" \ 140 | "(use \`make info' here to do that automatically)." 141 | 142 | info: 143 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 144 | @echo "Running Texinfo files through makeinfo..." 145 | make -C $(BUILDDIR)/texinfo info 146 | @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." 147 | 148 | gettext: 149 | $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale 150 | @echo 151 | @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." 152 | 153 | changes: 154 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes 155 | @echo 156 | @echo "The overview file is in $(BUILDDIR)/changes." 157 | 158 | linkcheck: 159 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck 160 | @echo 161 | @echo "Link check complete; look for any errors in the above output " \ 162 | "or in $(BUILDDIR)/linkcheck/output.txt." 163 | 164 | doctest: 165 | $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest 166 | @echo "Testing of doctests in the sources finished, look at the " \ 167 | "results in $(BUILDDIR)/doctest/output.txt." 168 | 169 | xml: 170 | $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml 171 | @echo 172 | @echo "Build finished. The XML files are in $(BUILDDIR)/xml." 173 | 174 | pseudoxml: 175 | $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml 176 | @echo 177 | @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." 178 | -------------------------------------------------------------------------------- /pyDISORT-master/doc/README: -------------------------------------------------------------------------------- 1 | make html 2 | -------------------------------------------------------------------------------- /pyDISORT-master/doc/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | REM Command file for Sphinx documentation 4 | 5 | if "%SPHINXBUILD%" == "" ( 6 | set SPHINXBUILD=sphinx-build 7 | ) 8 | set BUILDDIR=build 9 | set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% source 10 | set I18NSPHINXOPTS=%SPHINXOPTS% source 11 | if NOT "%PAPER%" == "" ( 12 | set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% 13 | set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% 14 | ) 15 | 16 | if "%1" == "" goto help 17 | 18 | if "%1" == "help" ( 19 | :help 20 | echo.Please use `make ^` where ^ is one of 21 | echo. html to make standalone HTML files 22 | echo. dirhtml to make HTML files named index.html in directories 23 | echo. singlehtml to make a single large HTML file 24 | echo. pickle to make pickle files 25 | echo. json to make JSON files 26 | echo. htmlhelp to make HTML files and a HTML help project 27 | echo. qthelp to make HTML files and a qthelp project 28 | echo. devhelp to make HTML files and a Devhelp project 29 | echo. epub to make an epub 30 | echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter 31 | echo. text to make text files 32 | echo. man to make manual pages 33 | echo. texinfo to make Texinfo files 34 | echo. gettext to make PO message catalogs 35 | echo. changes to make an overview over all changed/added/deprecated items 36 | echo. xml to make Docutils-native XML files 37 | echo. pseudoxml to make pseudoxml-XML files for display purposes 38 | echo. linkcheck to check all external links for integrity 39 | echo. doctest to run all doctests embedded in the documentation if enabled 40 | goto end 41 | ) 42 | 43 | if "%1" == "clean" ( 44 | for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i 45 | del /q /s %BUILDDIR%\* 46 | goto end 47 | ) 48 | 49 | 50 | %SPHINXBUILD% 2> nul 51 | if errorlevel 9009 ( 52 | echo. 53 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 54 | echo.installed, then set the SPHINXBUILD environment variable to point 55 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 56 | echo.may add the Sphinx directory to PATH. 57 | echo. 58 | echo.If you don't have Sphinx installed, grab it from 59 | echo.http://sphinx-doc.org/ 60 | exit /b 1 61 | ) 62 | 63 | if "%1" == "html" ( 64 | %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html 65 | if errorlevel 1 exit /b 1 66 | echo. 67 | echo.Build finished. The HTML pages are in %BUILDDIR%/html. 68 | goto end 69 | ) 70 | 71 | if "%1" == "dirhtml" ( 72 | %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml 73 | if errorlevel 1 exit /b 1 74 | echo. 75 | echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. 76 | goto end 77 | ) 78 | 79 | if "%1" == "singlehtml" ( 80 | %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml 81 | if errorlevel 1 exit /b 1 82 | echo. 83 | echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. 84 | goto end 85 | ) 86 | 87 | if "%1" == "pickle" ( 88 | %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle 89 | if errorlevel 1 exit /b 1 90 | echo. 91 | echo.Build finished; now you can process the pickle files. 92 | goto end 93 | ) 94 | 95 | if "%1" == "json" ( 96 | %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json 97 | if errorlevel 1 exit /b 1 98 | echo. 99 | echo.Build finished; now you can process the JSON files. 100 | goto end 101 | ) 102 | 103 | if "%1" == "htmlhelp" ( 104 | %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp 105 | if errorlevel 1 exit /b 1 106 | echo. 107 | echo.Build finished; now you can run HTML Help Workshop with the ^ 108 | .hhp project file in %BUILDDIR%/htmlhelp. 109 | goto end 110 | ) 111 | 112 | if "%1" == "qthelp" ( 113 | %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp 114 | if errorlevel 1 exit /b 1 115 | echo. 116 | echo.Build finished; now you can run "qcollectiongenerator" with the ^ 117 | .qhcp project file in %BUILDDIR%/qthelp, like this: 118 | echo.^> qcollectiongenerator %BUILDDIR%\qthelp\pyDISORT.qhcp 119 | echo.To view the help file: 120 | echo.^> assistant -collectionFile %BUILDDIR%\qthelp\pyDISORT.ghc 121 | goto end 122 | ) 123 | 124 | if "%1" == "devhelp" ( 125 | %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp 126 | if errorlevel 1 exit /b 1 127 | echo. 128 | echo.Build finished. 129 | goto end 130 | ) 131 | 132 | if "%1" == "epub" ( 133 | %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub 134 | if errorlevel 1 exit /b 1 135 | echo. 136 | echo.Build finished. The epub file is in %BUILDDIR%/epub. 137 | goto end 138 | ) 139 | 140 | if "%1" == "latex" ( 141 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex 142 | if errorlevel 1 exit /b 1 143 | echo. 144 | echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. 145 | goto end 146 | ) 147 | 148 | if "%1" == "latexpdf" ( 149 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex 150 | cd %BUILDDIR%/latex 151 | make all-pdf 152 | cd %BUILDDIR%/.. 153 | echo. 154 | echo.Build finished; the PDF files are in %BUILDDIR%/latex. 155 | goto end 156 | ) 157 | 158 | if "%1" == "latexpdfja" ( 159 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex 160 | cd %BUILDDIR%/latex 161 | make all-pdf-ja 162 | cd %BUILDDIR%/.. 163 | echo. 164 | echo.Build finished; the PDF files are in %BUILDDIR%/latex. 165 | goto end 166 | ) 167 | 168 | if "%1" == "text" ( 169 | %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text 170 | if errorlevel 1 exit /b 1 171 | echo. 172 | echo.Build finished. The text files are in %BUILDDIR%/text. 173 | goto end 174 | ) 175 | 176 | if "%1" == "man" ( 177 | %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man 178 | if errorlevel 1 exit /b 1 179 | echo. 180 | echo.Build finished. The manual pages are in %BUILDDIR%/man. 181 | goto end 182 | ) 183 | 184 | if "%1" == "texinfo" ( 185 | %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo 186 | if errorlevel 1 exit /b 1 187 | echo. 188 | echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. 189 | goto end 190 | ) 191 | 192 | if "%1" == "gettext" ( 193 | %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale 194 | if errorlevel 1 exit /b 1 195 | echo. 196 | echo.Build finished. The message catalogs are in %BUILDDIR%/locale. 197 | goto end 198 | ) 199 | 200 | if "%1" == "changes" ( 201 | %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes 202 | if errorlevel 1 exit /b 1 203 | echo. 204 | echo.The overview file is in %BUILDDIR%/changes. 205 | goto end 206 | ) 207 | 208 | if "%1" == "linkcheck" ( 209 | %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck 210 | if errorlevel 1 exit /b 1 211 | echo. 212 | echo.Link check complete; look for any errors in the above output ^ 213 | or in %BUILDDIR%/linkcheck/output.txt. 214 | goto end 215 | ) 216 | 217 | if "%1" == "doctest" ( 218 | %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest 219 | if errorlevel 1 exit /b 1 220 | echo. 221 | echo.Testing of doctests in the sources finished, look at the ^ 222 | results in %BUILDDIR%/doctest/output.txt. 223 | goto end 224 | ) 225 | 226 | if "%1" == "xml" ( 227 | %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml 228 | if errorlevel 1 exit /b 1 229 | echo. 230 | echo.Build finished. The XML files are in %BUILDDIR%/xml. 231 | goto end 232 | ) 233 | 234 | if "%1" == "pseudoxml" ( 235 | %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml 236 | if errorlevel 1 exit /b 1 237 | echo. 238 | echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml. 239 | goto end 240 | ) 241 | 242 | :end 243 | -------------------------------------------------------------------------------- /pyDISORT-master/doc/source/disort.rst: -------------------------------------------------------------------------------- 1 | .. _coda_base-module: 2 | 3 | Disort Module 4 | ================= 5 | 6 | This module contains a python wrapper function `run` to call the fortran function `disort` 7 | 8 | .. automodule:: disort 9 | :members: 10 | 11 | -------------------------------------------------------------------------------- /pyDISORT-master/doc/source/index.rst: -------------------------------------------------------------------------------- 1 | .. pyDISORT documentation master file, created by 2 | sphinx-quickstart on Sun Oct 1 19:12:34 2017. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to pyDISORT's documentation! 7 | ==================================== 8 | 9 | Contents: 10 | 11 | .. toctree:: 12 | :maxdepth: 2 13 | 14 | disort 15 | 16 | Indices and tables 17 | ================== 18 | 19 | * :ref:`genindex` 20 | * :ref:`modindex` 21 | * :ref:`search` 22 | 23 | -------------------------------------------------------------------------------- /pyDISORT-master/lib/disort/__version__.py: -------------------------------------------------------------------------------- 1 | __version__ = '0.0.1' 2 | -------------------------------------------------------------------------------- /pyDISORT-master/lib/disort/_disort.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielkoll/PyRADS-shortwave/9d86f7dc07bef37f832949a584f0abe2fd3b72c4/pyDISORT-master/lib/disort/_disort.so -------------------------------------------------------------------------------- /pyDISORT-master/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # ------------------------------------------------------ 3 | # Adapted from setup.py from CliMT project 4 | # ------------------------------------------------------ 5 | 6 | import os 7 | import sys 8 | import glob 9 | import string 10 | from numpy.distutils.core import setup 11 | from numpy.distutils import fcompiler 12 | from distutils.dep_util import newer 13 | 14 | from numpy import f2py 15 | f2py_path = f2py.__path__[0] 16 | direct = f2py_path 17 | while 1: 18 | base = os.path.basename(direct) 19 | if base=='': 20 | print '*f2py* not found in your python installation' 21 | raise SystemExit(0) 22 | direct = os.path.dirname(direct) 23 | if base=='lib' or base=='lib64': 24 | root = direct 25 | if 'bin' in os.listdir(root): 26 | f2py_exec_path = os.path.join(root,'bin') 27 | if 'f2py' in os.listdir(f2py_exec_path): 28 | f2py_bin = os.path.join(f2py_exec_path,'f2py') 29 | break 30 | 31 | Extensions = [ 32 | {'name':'disort', 33 | 'dir':'src/disort'}, 34 | ] 35 | 36 | # figure out which compiler we're goint to use 37 | compiler = fcompiler.get_default_fcompiler(requiref90=True) 38 | compiler = 'gnu95' # ensure gfortran 39 | for i in range(len(sys.argv)): 40 | if '--fcompiler' in sys.argv[i]: 41 | compiler = sys.argv.pop(i) 42 | compiler = compiler[compiler.index('=')+1:] 43 | print 'Using %s compiler' % compiler 44 | 45 | # set some fortran compiler-dependent flags 46 | if compiler == 'gnu95' or compiler == 'gnu': 47 | # f77flags='-ffixed-line-length-132 -fdefault-real-8' 48 | # f90flags='-fdefault-real-8' 49 | f77flags='-O3' 50 | f90flags='-O3' 51 | elif compiler == 'intel' or compiler == 'intelem': 52 | f77flags='-132 -r8 -w95 -w90 -mp' 53 | f90flags='-r8 -w95 -mp' 54 | elif compiler == 'ibm': 55 | f77flags='-qautodbl=dbl4 -qsuffix=f=f:cpp=F -qfixed=132' 56 | f90flags='-qautodbl=dbl4 -qsuffix=f=f90:cpp=F90 -qfree=f90' 57 | else: 58 | print 'Sorry, compiler %s not supported' % compiler 59 | sys.exit() 60 | 61 | for i in range(len(Extensions)): 62 | Defaults = { # 'cppflags':'-DIM=%i -DJM=%i -DKM=%i' % (IM,JM,KM), 63 | 'cppflags':'', 64 | 'f77flags':f77flags, 65 | 'f90flags':f90flags} 66 | Defaults.update(Extensions[i]) 67 | Extensions[i] = Defaults 68 | 69 | if compiler == 'ibm': 70 | for ext in Extensions: 71 | ext['cppflags']='-WF,'+string.join(ext['cppflags'].split(),',') 72 | 73 | def getSources(dir): 74 | # Gets list of source files for extensions 75 | SrcFile = os.path.join(dir,'sources_in_order_of_compilation') 76 | if os.path.exists(SrcFile): 77 | Sources = open(SrcFile).readlines() 78 | Sources = [os.path.join(dir,s[:-1]) for s in Sources] 79 | else: 80 | Sources = [] 81 | for pattern in ['*.f','*.F','*.f90','*.F90']: 82 | Sources += glob.glob(os.path.join(dir,'src',pattern)) # sgg: i changed to order 83 | Sources += glob.glob(os.path.join(dir,pattern)) # 84 | return Sources 85 | 86 | def buildNeeded(target,src): 87 | # Checks if source code is newer than extension, so extension needs to be rebuilt 88 | target = os.path.join('lib/disort',target) 89 | if not os.path.exists(target): 90 | return True 91 | for file in src: 92 | if newer(file,target): 93 | return True 94 | print 'Extension %s is up to date' % os.path.basename(target) 95 | return False 96 | 97 | def build_ext(name=None, dir=None, cppflags='', f77flags='', f90flags='', 98 | lib='', libdir='', incdir=''): 99 | # Builds an extension 100 | src = getSources(dir) 101 | target = '_%s.so' % name 102 | driver = glob.glob(os.path.join(dir,'Driver.f'))[0] 103 | f77flags = '"%s %s"' % (cppflags,f77flags) 104 | f90flags = '"%s %s"' % (cppflags,f90flags) 105 | if buildNeeded(target,src): 106 | print '\n Building %s ... \n' % os.path.basename(target) 107 | # generate signature file 108 | #os.system('f2py --overwrite-signature %s -m _%s -h _%s.pyf'%(driver,name,name)) 109 | ff = '%s '*len(src) 110 | #sformat = '/usr/bin/f2py --overwrite-signature '+ff+' -m _%s -h _%s.pyf' 111 | sformat = f2py_bin+' --overwrite-signature '+ff+' -m _%s -h _%s.pyf' 112 | args = src + [name,name] 113 | print sformat % tuple(args) 114 | os.system(sformat % tuple(args)) 115 | # compile extension 116 | F2pyCommand = [] 117 | # F2pyCommand.append('/usr/bin/f2py -c -m _%s' % name) 118 | F2pyCommand.append('%s -c ' % f2py_bin) 119 | F2pyCommand.append('--fcompiler=%s' % compiler) 120 | F2pyCommand.append('-I%s' % dir) 121 | F2pyCommand.append('-I%s' % os.path.join(dir,'include')) 122 | F2pyCommand.append('-I%s' % os.path.join(dir,'src')) 123 | F2pyCommand.append('-I%s' % os.path.join(dir,'src','include')) 124 | if incdir is not '': 125 | for i in incdir: 126 | F2pyCommand.append('-I%s' % i) 127 | if libdir is not '': 128 | for i in libdir: 129 | F2pyCommand.append('-L%s' % i) 130 | if lib is not '': 131 | for i in lib: 132 | F2pyCommand.append('-l%s' % i) 133 | F2pyCommand.append('--f77flags=%s' % f77flags) 134 | F2pyCommand.append('--f90flags=%s' % f90flags) 135 | F2pyCommand.append('_%s.pyf' % name) 136 | F2pyCommand.append('%s' % string.join(src)) 137 | F2pyCommand = string.join(F2pyCommand) 138 | print F2pyCommand 139 | if os.system(F2pyCommand) > 0: 140 | print '+++ Compilation failed' 141 | sys.exit() 142 | os.system('mv -f _%s.so lib/disort' % name) 143 | # os.system('rm -f _%s.pyf' % name) 144 | 145 | # Build all extensions 146 | for ext in Extensions: 147 | build_ext(**ext) 148 | 149 | # Finish the setup 150 | # note: setup() cannot copy directories, and falls over 151 | # trying to copy the CVS directory in climt/lib/data 152 | # workaround: make data list which specifically excludes CVS 153 | os.chdir('lib/') 154 | DataFiles = [] 155 | for File in glob.glob('test/*.py'): 156 | if 'CVS' not in File: 157 | DataFiles.append('../'+File) 158 | print DataFiles 159 | os.chdir('..') 160 | 161 | setup(name = "disort", 162 | version = open('Version').read()[:-1], 163 | description = "Python wrapper to the DISORT library", 164 | author = "Sebati\'an Gimeno Garc\'\ia", 165 | author_email = "sebastian.gimenogarcia@gmail.com", 166 | packages = ['disort'], 167 | package_dir = {'':'lib'}, 168 | package_data = {'disort':['*.so']+DataFiles}) 169 | -------------------------------------------------------------------------------- /pyDISORT-master/src/disort/Driver.f: -------------------------------------------------------------------------------- 1 | c ------------------------------------------------------------------- 2 | c Python wrapper to the DISORT radiative transfer solver 3 | c 4 | c Author: Sebastian Gimeno Garcia 5 | c 6 | c 7 | c License: 8 | c 9 | c Do whatever you want with this piece of code. Enjoy it. If you 10 | c find it helpful, think about the authors of DISORT and drink to 11 | c their health, and why not, also to mine. 12 | c 13 | c If you find any bug, please let me now. 14 | c 15 | c Ref: 16 | c 17 | c K. Stamnes, SC. Tsay, W. Wiscombe and K. Jayaweera, Numerically 18 | c stable algorithm for discrete-ordinate-method radiative 19 | c transfer in multiple scattering and emitting layered media, 20 | c Appl Opt 27 (1988) (12), pp. 2502–2509. 21 | c ------------------------------------------------------------------- 22 | 23 | c ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 24 | c Driver based on: 25 | c 26 | c RCS version control information: 27 | c $Header: DISOTEST.f,v 2.1 2000/04/03 21:21:55 laszlo Exp $ 28 | c ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 29 | 30 | SUBROUTINE RUN( 31 | I MAXCLY, DTAUC, SSALB, MAXMOM, TEMPER, 32 | I IPHAS, GG, 33 | I WVNMLO, WVNMHI, USRTAU, MAXULV, UTAU, NSTR, 34 | I USRANG, MAXUMU, UMU, MAXPHI, PHI, IBCND, FBEAM, 35 | I UMU0, PHI0, FISOT, LAMBER, ALBEDO, BTEMP, 36 | I TTEMP, TEMIS, PLANK, ONLYFL, ACCUR, PRNT, 37 | O RFLDIR, RFLDN, FLUP, DFDT, UAVG, UU, 38 | O ALBMED, TRNMED 39 | & ) 40 | 41 | 42 | c Runs test problems for DISORT and checks answers. These 43 | c problems test almost all logical branches in DISORT. 44 | 45 | c It is HIGHLY recommended that you use the code below as a template 46 | c for creating your own CALLs to DISORT, rather than starting from 47 | c scratch. This will prevent a lot of mistakes and ensure that every 48 | c input argument gets a value. Note in particular how GETMOM is 49 | c sometimes called to fill an array section of PMOM (for one layer); 50 | c several people have done this incorrectly in attempting to write it 51 | c ab initio (passing array sections for arrays that do not start at 52 | c element 1 is tricky). 53 | 54 | c Note that the ratio to the 'correct answer' may occasionally be 55 | c significantly different from unity -- even so different that 56 | c the ratio just prints as ****** rather than a number. However, 57 | c this mostly occurs for values of flux or intensity that are very 58 | c small compared to the forcing functions (that is, small compared 59 | c to internal thermal emission and/or radiation incident at the 60 | c boundaries). The printed number 'SERIOUSLY NON-UNIT RATIOS' 61 | c attempts to count just the cases where there is a real disagreement 62 | c and not those where quantitites are down at their noise level 63 | c (defined as 10^(-6) times their maximum value). 64 | 65 | c Further documentation can be found in the file DISOTEST.doc. 66 | 67 | 68 | c Routines called : 69 | 70 | c DISORT: The discrete ordinates radiative transfer program 71 | 72 | c BDREF: Sets bidirectional reflectance of lower boundary 73 | 74 | c GETMOM: Sets phase function Legendre coefficients 75 | 76 | c PRTFIN: Prints fluxes and intensities and their ratios to 77 | c the correct values 78 | 79 | c CHEKDO: Data block containing correct fluxes and intensities 80 | 81 | c RATIO : Ratio of calculated to correct value with underflow 82 | c and overflow protection (kept in file DISORT.f) 83 | 84 | c INPUT: IPHAS Phase function options 85 | c 1 : Isotropic 86 | c 2 : Rayleigh 87 | c 3 : Henyey-Greenstein with asymmetry factor GG 88 | c 4 : Haze L as specified by Garcia/Siewert 89 | c 5 : Cloud C.1 as specified by Garcia/Siewert 90 | 91 | c GG Asymmetry factor for Henyey-Greenstein case 92 | 93 | c NMOM Index of highest Legendre coefficient needed 94 | c ( = number of streams 'NSTR' chosen 95 | c for the discrete ordinate method) 96 | c+---------------------------------------------------------------------+ 97 | c 98 | c ** DISORT I/O specifications ** 99 | 100 | CF2PY INTENT(HIDE) :: MAXCLY, MAXUMU, MAXPHI, MAXULV 101 | CF2PY INTENT(IN) :: DTAUC, SSALB, TEMPER, MAXMOM 102 | CF2PY INTENT(IN) :: IPHAS, GG, 103 | CF2PY INTENT(IN) :: WVNMLO, WVNMHI, USRTAU, UTAU, NSTR 104 | CF2PY INTENT(IN) :: USRANG, UMU, PHI, IBCND, FBEAM 105 | CF2PY INTENT(IN) :: UMU0, PHI0, FISOT, LAMBER, ALBEDO, BTEMP 106 | CF2PY INTENT(IN) :: TTEMP, TEMIS, PLANK, ONLYFL, ACCUR, PRNT 107 | CF2PY INTENT(OUT) :: RFLDIR, RFLDN, FLUP, DFDT, UAVG, UU 108 | CF2PY INTENT(OUT) :: ALBMED, TRNMED 109 | 110 | INTEGER MAXCLY, MAXULV, MAXUMU, MAXPHI 111 | INTEGER MAXMOM 112 | c$$ PARAMETER ( MAXMOM = 299) 113 | CHARACTER HEADER*127 114 | LOGICAL LAMBER, PLANK, ONLYFL, PRNT(5), USRANG, USRTAU 115 | INTEGER IBCND, NMOM, NLYR, NUMU, NSTR, NPHI, NTAU 116 | REAL ACCUR, ALBEDO, BTEMP, DTAUC( MAXCLY ), FBEAM, FISOT, 117 | & PHI( MAXPHI ), PMOM( 0:MAXMOM, MAXCLY ), 118 | & PHI0, SSALB( MAXCLY ), TEMPER( 0:MAXCLY ), TEMIS, TTEMP, 119 | & WVNMLO, WVNMHI, UMU( MAXUMU ), UMU0, UTAU( MAXULV ) 120 | 121 | REAL RFLDIR( MAXULV ), RFLDN( MAXULV ), FLUP( MAXULV ), 122 | & DFDT( MAXULV ), UAVG( MAXULV ), 123 | & UU( MAXUMU, MAXULV, MAXPHI ), ALBMED( MAXUMU ), 124 | & TRNMED( MAXUMU ) 125 | 126 | INTEGER IPHAS( MAXCLY ) 127 | REAL GG( MAXCLY ) 128 | 129 | c+---------------------------------------------------------------------+ 130 | 131 | INTEGER MXTAU, MXMU, MXPHI 132 | PARAMETER ( MXTAU = 5, MXMU = 32, MXPHI = 3 ) 133 | INTEGER LC 134 | REAL PI 135 | 136 | c+---------------------------------------------------------------------+ 137 | c .. External Subroutines .. 138 | 139 | EXTERNAL DISORT, ERRMSG, GETMOM, PRTFIN 140 | c .. 141 | c .. Intrinsic Functions .. 142 | 143 | INTRINSIC ASIN, FLOAT, INDEX 144 | c .. 145 | 146 | 147 | PI = 2.* ASIN( 1.0 ) 148 | 149 | NLYR = MAXCLY 150 | NMOM = NSTR 151 | DO LC = 1, NLYR 152 | CALL GETMOM( IPHAS( LC ), GG( LC ), NMOM, PMOM(0,LC) ) 153 | END DO 154 | NTAU = MAXULV 155 | NPHI = MAXPHI 156 | NUMU = MAXUMU 157 | HEADER = 'Python wrapper to the DISORT radiative transfer solver' 158 | 159 | CALL DISORT( NLYR, DTAUC, SSALB, NMOM, PMOM, TEMPER, 160 | & WVNMLO, WVNMHI, USRTAU, NTAU, UTAU, NSTR, 161 | & USRANG, NUMU, UMU, NPHI, PHI, IBCND, FBEAM, 162 | & UMU0, PHI0, FISOT, LAMBER, ALBEDO, BTEMP, 163 | & TTEMP, TEMIS, PLANK, ONLYFL, ACCUR, PRNT, 164 | & HEADER, MAXCLY, MAXULV, MAXUMU, MAXPHI, 165 | & MAXMOM, RFLDIR, RFLDN, FLUP, DFDT, UAVG, UU, 166 | & ALBMED, TRNMED ) 167 | 168 | 169 | END 170 | -------------------------------------------------------------------------------- /pyDISORT-master/src/disort/src/BDREF.f: -------------------------------------------------------------------------------- 1 | c ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | c RCS version control information: 3 | c $Header: BDREF.f,v 2.1 2000/03/27 21:40:51 laszlo Exp $ 4 | c ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5 | 6 | REAL FUNCTION BDREF( WVNMLO, WVNMHI, MU, MUP, DPHI ) 7 | 8 | c Supplies surface bi-directional reflectivity. 9 | c 10 | c This is only a "stub" version. The user must replace this 11 | c by his/her own BDREF function. 12 | c 13 | c 14 | c NOTE 1: Bidirectional reflectivity in DISORT is defined 15 | c by Eq. 39 in STWL. 16 | c NOTE 2: Both MU and MU0 (cosines of reflection and incidence 17 | c angles) are positive. 18 | c 19 | c INPUT: 20 | c 21 | c WVNMLO : Lower wavenumber (inv cm) of spectral interval 22 | c 23 | c WVNMHI : Upper wavenumber (inv cm) of spectral interval 24 | c 25 | c MU : Cosine of angle of reflection (positive) 26 | c 27 | c MUP : Cosine of angle of incidence (positive) 28 | c 29 | c DPHI : Difference of azimuth angles of incidence and reflection 30 | c (radians) 31 | c 32 | c 33 | c Called by- DREF, SURFAC 34 | 35 | c +-------------------------------------------------------------------+ 36 | c 37 | c .. Scalar Arguments .. 38 | 39 | REAL DPHI, MU, MUP, WVNMHI, WVNMLO 40 | c .. 41 | c .. External Subroutines .. 42 | 43 | EXTERNAL ERRMSG 44 | c .. 45 | 46 | WRITE ( *, '(//,7(1X,A,/))' ) 47 | & 'To use a bidirectionally reflecting lower boundary you must', 48 | & 'replace file BDREF.f with your own file. In that file, you ', 49 | & 'should supply the bidirectional reflectivity, as a function ', 50 | & 'of the cosine of angle of reflection, the cosine of angle ', 51 | & 'of incidence, and the difference of azimuth angles of ', 52 | & 'incidence and reflection. See DISORT.doc for more information', 53 | & 'and subroutine BDREF in file DISOTEST.f for an example.' 54 | 55 | CALL ERRMSG( 'BDREF--Please supply a surface BDRF model', .TRUE. ) 56 | 57 | BDREF = 0.0 58 | 59 | RETURN 60 | END 61 | -------------------------------------------------------------------------------- /pyDISORT-master/src/disort/src/ErrPack.f: -------------------------------------------------------------------------------- 1 | c ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | c RCS version control information: 3 | c $Header: ErrPack.f,v 2.1 2000/03/27 21:40:49 laszlo Exp $ 4 | c ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5 | 6 | SUBROUTINE ErrMsg( MESSAG, FATAL ) 7 | 8 | c Print out a warning or error message; abort if error 9 | 10 | LOGICAL FATAL, MsgLim 11 | CHARACTER*(*) MESSAG 12 | INTEGER MaxMsg, NumMsg 13 | SAVE MaxMsg, NumMsg, MsgLim 14 | DATA NumMsg / 0 /, MaxMsg / 100 /, MsgLim / .FALSE. / 15 | 16 | 17 | IF ( FATAL ) THEN 18 | WRITE ( *, '(/,2A,/)' ) ' ******* ERROR >>>>>> ', MESSAG 19 | STOP 20 | END IF 21 | 22 | NumMsg = NumMsg + 1 23 | IF( MsgLim ) RETURN 24 | 25 | IF ( NumMsg.LE.MaxMsg ) THEN 26 | WRITE ( *, '(/,2A,/)' ) ' ******* WARNING >>>>>> ', MESSAG 27 | ELSE 28 | WRITE ( *,99 ) 29 | MsgLim = .True. 30 | ENDIF 31 | 32 | RETURN 33 | 34 | 99 FORMAT( //,' >>>>>> TOO MANY WARNING MESSAGES -- ', 35 | & 'They will no longer be printed <<<<<<<', // ) 36 | END 37 | 38 | LOGICAL FUNCTION WrtBad ( VarNam ) 39 | 40 | c Write names of erroneous variables and return 'TRUE' 41 | 42 | c INPUT : VarNam = Name of erroneous variable to be written 43 | c ( CHARACTER, any length ) 44 | 45 | CHARACTER*(*) VarNam 46 | INTEGER MaxMsg, NumMsg 47 | SAVE NumMsg, MaxMsg 48 | DATA NumMsg / 0 /, MaxMsg / 50 / 49 | 50 | 51 | WrtBad = .TRUE. 52 | NumMsg = NumMsg + 1 53 | WRITE ( *, '(3A)' ) ' **** Input variable ', VarNam, 54 | & ' in error ****' 55 | IF ( NumMsg.EQ.MaxMsg ) 56 | & CALL ErrMsg ( 'Too many input errors. Aborting...', .TRUE. ) 57 | 58 | RETURN 59 | END 60 | 61 | LOGICAL FUNCTION WrtDim ( DimNam, MinVal ) 62 | 63 | c Write name of too-small symbolic dimension and 64 | c the value it should be increased to; return 'TRUE' 65 | 66 | c INPUT : DimNam = Name of symbolic dimension which is too small 67 | c ( CHARACTER, any length ) 68 | c Minval = Value to which that dimension should be 69 | c increased (at least) 70 | 71 | CHARACTER*(*) DimNam 72 | INTEGER MinVal 73 | 74 | 75 | WRITE ( *, '(/,3A,I7)' ) ' **** Symbolic dimension ', DimNam, 76 | & ' should be increased to at least ', MinVal 77 | WrtDim = .TRUE. 78 | 79 | RETURN 80 | END 81 | 82 | LOGICAL FUNCTION TstBad( VarNam, RelErr ) 83 | 84 | c Write name (VarNam) of variable failing self-test and its 85 | c percent error from the correct value; return 'FALSE'. 86 | 87 | CHARACTER*(*) VarNam 88 | REAL RelErr 89 | 90 | 91 | TstBad = .FALSE. 92 | WRITE( *, '(/,3A,1P,E11.2,A)' ) 93 | & ' Output variable ', VarNam,' differed by ', 100.*RelErr, 94 | & ' per cent from correct value. Self-test failed.' 95 | 96 | RETURN 97 | END 98 | 99 | -------------------------------------------------------------------------------- /pyDISORT-master/src/disort/src/GETMOM.f: -------------------------------------------------------------------------------- 1 | SUBROUTINE GETMOM( IPHAS, GG, NMOM, PMOM ) 2 | 3 | c Calculate phase function Legendre expansion coefficients 4 | c in various special cases 5 | 6 | 7 | c INPUT: IPHAS Phase function options 8 | c 1 : Isotropic 9 | c 2 : Rayleigh 10 | c 3 : Henyey-Greenstein with asymmetry factor GG 11 | c 4 : Haze L as specified by Garcia/Siewert 12 | c 5 : Cloud C.1 as specified by Garcia/Siewert 13 | 14 | c GG Asymmetry factor for Henyey-Greenstein case 15 | 16 | c NMOM Index of highest Legendre coefficient needed 17 | c ( = number of streams 'NSTR' chosen 18 | c for the discrete ordinate method) 19 | 20 | c OUTPUT: PMOM(K) Legendre expansion coefficients (K=0 to NMOM) 21 | c (be sure to dimension '0:maxval' in calling 22 | c program) 23 | 24 | c Reference: Garcia, R. and C. Siewert, 1985: Benchmark Results 25 | c in Radiative Transfer, Transp. Theory and Stat. 26 | c Physics 14, 437-484, Tables 10 And 17 27 | c ------------------------------------------------------------------ 28 | 29 | c .. Scalar Arguments .. 30 | 31 | INTEGER IPHAS, NMOM 32 | REAL GG 33 | c .. 34 | c .. Array Arguments .. 35 | 36 | REAL PMOM( 0:NMOM ) 37 | c .. 38 | c .. Local Scalars .. 39 | 40 | INTEGER K 41 | c .. 42 | c .. Local Arrays .. 43 | 44 | REAL CLDMOM( 299 ), HAZELM( 82 ) 45 | c .. 46 | c .. External Subroutines .. 47 | 48 | EXTERNAL ERRMSG 49 | c .. 50 | c .. Intrinsic Functions .. 51 | 52 | INTRINSIC MIN 53 | c .. 54 | 55 | DATA HAZELM / 2.41260, 3.23047, 3.37296, 3.23150, 2.89350, 56 | A 2.49594, 2.11361, 1.74812, 1.44692, 1.17714, 57 | B 0.96643, 0.78237, 0.64114, 0.51966, 0.42563, 58 | C 0.34688, 0.28351, 0.23317, 0.18963, 0.15788, 59 | D 0.12739, 0.10762, 0.08597, 0.07381, 0.05828, 60 | E 0.05089, 0.03971, 0.03524, 0.02720, 0.02451, 61 | F 0.01874, 0.01711, 0.01298, 0.01198, 0.00904, 62 | G 0.00841, 0.00634, 0.00592, 0.00446, 0.00418, 63 | H 0.00316, 0.00296, 0.00225, 0.00210, 0.00160, 64 | I 0.00150, 0.00115, 0.00107, 0.00082, 0.00077, 65 | J 0.00059, 0.00055, 0.00043, 0.00040, 0.00031, 66 | K 0.00029, 0.00023, 0.00021, 0.00017, 0.00015, 67 | L 0.00012, 0.00011, 0.00009, 0.00008, 0.00006, 68 | M 0.00006, 0.00005, 0.00004, 0.00004, 0.00003, 69 | N 0.00003, 3*0.00002, 8*0.00001 / 70 | 71 | DATA ( CLDMOM(K), K = 1, 159 ) / 72 | A 2.544, 3.883, 4.568, 5.235, 5.887, 6.457, 7.177, 7.859, 73 | B 8.494, 9.286, 9.856, 10.615, 11.229, 11.851, 12.503, 13.058, 74 | C 13.626, 14.209, 14.660, 15.231, 15.641, 16.126, 16.539, 16.934, 75 | D 17.325, 17.673, 17.999, 18.329, 18.588, 18.885, 19.103, 19.345, 76 | E 19.537, 19.721, 19.884, 20.024, 20.145, 20.251, 20.330, 20.401, 77 | F 20.444, 20.477, 20.489, 20.483, 20.467, 20.427, 20.382, 20.310, 78 | G 20.236, 20.136, 20.036, 19.909, 19.785, 19.632, 19.486, 19.311, 79 | H 19.145, 18.949, 18.764, 18.551, 18.348, 18.119, 17.901, 17.659, 80 | I 17.428, 17.174, 16.931, 16.668, 16.415, 16.144, 15.883, 15.606, 81 | J 15.338, 15.058, 14.784, 14.501, 14.225, 13.941, 13.662, 13.378, 82 | K 13.098, 12.816, 12.536, 12.257, 11.978, 11.703, 11.427, 11.156, 83 | L 10.884, 10.618, 10.350, 10.090, 9.827, 9.574, 9.318, 9.072, 84 | M 8.822, 8.584, 8.340, 8.110, 7.874, 7.652, 7.424, 7.211, 6.990, 85 | N 6.785, 6.573, 6.377, 6.173, 5.986, 5.790, 5.612, 5.424, 5.255, 86 | O 5.075, 4.915, 4.744, 4.592, 4.429, 4.285, 4.130, 3.994, 3.847, 87 | P 3.719, 3.580, 3.459, 3.327, 3.214, 3.090, 2.983, 2.866, 2.766, 88 | Q 2.656, 2.562, 2.459, 2.372, 2.274, 2.193, 2.102, 2.025, 1.940, 89 | R 1.869, 1.790, 1.723, 1.649, 1.588, 1.518, 1.461, 1.397, 1.344, 90 | S 1.284, 1.235, 1.179, 1.134, 1.082, 1.040, 0.992, 0.954, 0.909 / 91 | DATA ( CLDMOM(K), K = 160, 299 ) / 92 | T 0.873, 0.832, 0.799, 0.762, 0.731, 0.696, 0.668, 0.636, 0.610, 93 | U 0.581, 0.557, 0.530, 0.508, 0.483, 0.463, 0.440, 0.422, 0.401, 94 | V 0.384, 0.364, 0.349, 0.331, 0.317, 0.301, 0.288, 0.273, 0.262, 95 | W 0.248, 0.238, 0.225, 0.215, 0.204, 0.195, 0.185, 0.177, 0.167, 96 | X 0.160, 0.151, 0.145, 0.137, 0.131, 0.124, 0.118, 0.112, 0.107, 97 | Y 0.101, 0.097, 0.091, 0.087, 0.082, 0.079, 0.074, 0.071, 0.067, 98 | Z 0.064, 0.060, 0.057, 0.054, 0.052, 0.049, 0.047, 0.044, 0.042, 99 | A 0.039, 0.038, 0.035, 0.034, 0.032, 0.030, 0.029, 0.027, 0.026, 100 | B 0.024, 0.023, 0.022, 0.021, 0.020, 0.018, 0.018, 0.017, 0.016, 101 | C 0.015, 0.014, 0.013, 0.013, 0.012, 0.011, 0.011, 0.010, 0.009, 102 | D 0.009, 3*0.008, 2*0.007, 3*0.006, 4*0.005, 4*0.004, 6*0.003, 103 | E 9*0.002, 18*0.001 / 104 | 105 | 106 | IF ( IPHAS.LT.1 .OR. IPHAS.GT.5 ) 107 | & CALL ERRMSG( 'GETMOM--bad input variable IPHAS',.TRUE.) 108 | 109 | IF ( IPHAS.EQ.3 .AND. (GG.LE.-1.0 .OR. GG.GE.1.0) ) 110 | & CALL ERRMSG( 'GETMOM--bad input variable GG',.TRUE.) 111 | 112 | IF ( NMOM.LT.2 ) 113 | & CALL ERRMSG( 'GETMOM--bad input variable NMOM',.TRUE.) 114 | 115 | 116 | PMOM(0) = 1.0 117 | DO 10 K = 1, NMOM 118 | PMOM(K) = 0.0 119 | 10 CONTINUE 120 | 121 | 122 | IF ( IPHAS.EQ.2 ) THEN 123 | c ** Rayleigh phase function 124 | PMOM(2) = 0.1 125 | 126 | ELSE IF ( IPHAS.EQ.3 ) THEN 127 | c ** Henyey-Greenstein phase fcn 128 | DO 20 K = 1, NMOM 129 | PMOM(K) = GG**K 130 | 20 CONTINUE 131 | 132 | ELSE IF ( IPHAS.EQ.4 ) THEN 133 | c ** Haze-L phase function 134 | DO 30 K = 1, MIN(82,NMOM) 135 | PMOM(K) = HAZELM(K) / ( 2*K+1 ) 136 | 30 CONTINUE 137 | 138 | ELSE IF ( IPHAS.EQ.5 ) THEN 139 | c ** Cloud C.1 phase function 140 | DO 40 K = 1, MIN(298,NMOM) 141 | PMOM(K) = CLDMOM(K) / ( 2*K+1 ) 142 | 40 CONTINUE 143 | 144 | END IF 145 | 146 | END 147 | 148 | -------------------------------------------------------------------------------- /pyDISORT-master/src/disort/src/PRTFIN.f: -------------------------------------------------------------------------------- 1 | SUBROUTINE PRTFIN( UTAU, NTAU, UMU, NUMU, PHI, NPHI, MAXULV, 2 | & MAXUMU, ONLYFL, RFLDIR, RFLDN, FLUP, DFDT, 3 | & UU, TSTFIR, TSTFDN, TSTFUP, TSTDFD, TSTUU, 4 | & MAXTAU, MAXMU, MAXAZ ) 5 | 6 | c Print DISORT results and, directly beneath them, their 7 | c ratios to the correct answers; print number of non-unit 8 | c ratios that occur but try to count just the cases where 9 | c there is a real disagreement and not those where flux or 10 | c intensity are down at their noise level (defined as 10^(-6) 11 | c times their maximum value). d(flux)/d(tau) is treated the 12 | c same as fluxes in this noise estimation even though it 13 | c is a different type of quantity (although with flux units). 14 | 15 | c INPUT : TSTFIR correct direct flux 16 | c TSTFDN correct diffuse down flux 17 | c TSTFUP correct diffuse up flux 18 | c TSTDFD correct d(flux)/d(optical depth) 19 | c TSTUU correct intensity 20 | c (remaining input = DISORT I/O variables) 21 | 22 | c -------------------------------------------------------------------- 23 | 24 | c .. Parameters .. 25 | 26 | INTEGER MAXRAT 27 | PARAMETER ( MAXRAT = 100 ) 28 | c .. 29 | c .. Scalar Arguments .. 30 | 31 | LOGICAL ONLYFL 32 | INTEGER MAXAZ, MAXMU, MAXTAU, MAXULV, MAXUMU, NPHI, NTAU, NUMU 33 | c .. 34 | c .. Array Arguments .. 35 | 36 | REAL DFDT( * ), FLUP( * ), PHI( * ), RFLDIR( * ), RFLDN( * ), 37 | & TSTDFD( * ), TSTFDN( * ), TSTFIR( * ), TSTFUP( * ), 38 | & TSTUU( MAXTAU, MAXMU, MAXAZ ), UMU( * ), UTAU( * ), 39 | & UU( MAXUMU, MAXULV, * ) 40 | c .. 41 | c .. Local Scalars .. 42 | 43 | INTEGER IU, J, LU, NUMBAD 44 | REAL FLXMAX, FNOISE, RAT, RAT1, RAT2, RAT3, RAT4, UMAX, UNOISE 45 | c .. 46 | c .. Local Arrays .. 47 | 48 | REAL RATV( MAXRAT ) 49 | c .. 50 | c .. External Functions .. 51 | 52 | REAL RATIO 53 | EXTERNAL RATIO 54 | c .. 55 | c .. External Subroutines .. 56 | 57 | EXTERNAL ERRMSG 58 | c .. 59 | c .. Statement Functions .. 60 | 61 | LOGICAL BADRAT 62 | c .. 63 | c .. Statement Function definitions .. 64 | 65 | BADRAT( RAT ) = (RAT.LT.0.99) .OR. (RAT.GT.1.01) 66 | c .. 67 | 68 | 69 | IF ( NTAU.GT.MAXTAU .OR. NUMU.GT.MAXMU .OR. NPHI.GT.MAXAZ ) CALL 70 | & ERRMSG( 'PRTFIN--out of bounds in comparator arrays', .TRUE.) 71 | 72 | FLXMAX = 0.0 73 | DO 5 LU = 1, NTAU 74 | FLXMAX = MAX( FLXMAX, TSTFIR(LU), TSTFDN(LU), TSTFUP(LU) ) 75 | 5 CONTINUE 76 | FNOISE = 1.E-6 * FLXMAX 77 | IF( FLXMAX.LE.0.0 ) 78 | & CALL ERRMSG( 'PRTFIN--all fluxes zero or negative', .FALSE.) 79 | IF( FNOISE.LE.0.0 ) 80 | & CALL ERRMSG( 'PRTFIN--all fluxes near underflowing', .FALSE.) 81 | 82 | NUMBAD = 0 83 | 84 | WRITE(*,'(//,A,/,A,/,A)') 85 | & ' <-------------- FLUXES -------------->', 86 | & ' Optical Downward Downward Upward'// 87 | & ' d(Net Flux)', 88 | & ' Depth Direct Diffuse Diffuse'// 89 | & ' / d(Op Dep)' 90 | 91 | DO 10 LU = 1, NTAU 92 | 93 | WRITE( *,'(0P,F11.4,1P,4E15.4)') UTAU(LU), RFLDIR(LU), 94 | & RFLDN(LU), FLUP(LU), DFDT(LU) 95 | RAT1 = RATIO( RFLDIR(LU), TSTFIR(LU) ) 96 | RAT2 = RATIO( RFLDN(LU), TSTFDN(LU) ) 97 | RAT3 = RATIO( FLUP(LU), TSTFUP(LU) ) 98 | RAT4 = RATIO( DFDT(LU), TSTDFD(LU) ) 99 | WRITE( *,'(11X,4( '' ('',F9.4,'')''))') 100 | & RAT1, RAT2, RAT3, RAT4 101 | 102 | IF( BADRAT(RAT1) .AND. ABS(RFLDIR(LU)).GT.FNOISE ) 103 | & NUMBAD = NUMBAD+1 104 | IF( BADRAT(RAT2) .AND. ABS(RFLDN(LU)).GT.FNOISE ) 105 | & NUMBAD = NUMBAD+1 106 | IF( BADRAT(RAT3) .AND. ABS(FLUP(LU)).GT.FNOISE ) 107 | & NUMBAD = NUMBAD+1 108 | IF( BADRAT(RAT4) .AND. ABS(DFDT(LU)).GT.FNOISE ) 109 | & NUMBAD = NUMBAD+1 110 | 111 | 10 CONTINUE 112 | 113 | 114 | IF ( ONLYFL ) GO TO 100 115 | 116 | IF ( NUMU.GT.MAXRAT .OR. NPHI.GT.MAXRAT ) 117 | & CALL ERRMSG( 'PRTFIN--increase parameter MAXRAT', .TRUE.) 118 | 119 | 120 | c ** Print intensities 121 | 122 | IF ( NPHI.GT.8 ) CALL ERRMSG 123 | & ( 'PRTFIN--intensity FORMATs inadequate',.FALSE.) 124 | 125 | UMAX = 0.0 126 | DO 36 LU = 1, NTAU 127 | DO 35 IU = 1, NUMU 128 | DO 34 J = 1, NPHI 129 | UMAX = MAX( UMAX, TSTUU(LU,IU,J) ) 130 | 34 CONTINUE 131 | 35 CONTINUE 132 | 36 CONTINUE 133 | UNOISE = 1.E-6 * UMAX 134 | IF( UMAX.LE.0.0 ) CALL ERRMSG 135 | & ( 'PRTFIN--all intensities zero or negative',.FALSE.) 136 | IF( UNOISE.LE.0.0 ) CALL ERRMSG 137 | & ( 'PRTFIN--all intensities near underflowing',.FALSE.) 138 | 139 | WRITE( *,'(//,A,//,A,/,A,/,A,8(F10.1,4X))' ) 140 | & ' ******** I N T E N S I T I E S *********', 141 | & ' Polar Azimuthal Angles (Degrees)', 142 | & ' Optical Angle', 143 | & ' Depth Cosine', ( PHI(J), J = 1, NPHI ) 144 | 145 | DO 60 LU = 1, NTAU 146 | 147 | DO 50 IU = 1, NUMU 148 | 149 | IF( IU.EQ.1 ) WRITE( *,'(/,0P,F10.3,F8.3,1P,8E14.4)') 150 | & UTAU(LU), UMU(IU), ( UU( IU,LU,J ), J = 1, NPHI ) 151 | 152 | IF( IU.GT.1 ) WRITE( *,'(10X,0P,F8.3, 1P,8E14.4)') 153 | & UMU(IU), ( UU( IU,LU,J ), J = 1, NPHI ) 154 | 155 | DO 40 J = 1, NPHI 156 | RATV(J) = RATIO( UU(IU,LU,J), TSTUU(LU,IU,J) ) 157 | IF( BADRAT(RATV(J)) .AND. ABS(UU(IU,LU,J)).GT.UNOISE ) 158 | & NUMBAD = NUMBAD + 1 159 | 40 CONTINUE 160 | 161 | WRITE( *,'(18X, 8(:,'' ('',F9.4,'')''))') 162 | & ( RATV(J), J = 1, NPHI ) 163 | 164 | 50 CONTINUE 165 | 60 CONTINUE 166 | 167 | 100 CONTINUE 168 | IF( NUMBAD.GT.0 ) WRITE( *,300) ' ==== ', NUMBAD, 169 | & ' SERIOUSLY NON-UNIT RATIOS ====' 170 | 171 | RETURN 172 | 173 | 300 FORMAT( //,1X,45('='),/,A,I4,A,/,1X,45('=') ) 174 | END 175 | -------------------------------------------------------------------------------- /pyDISORT-master/test/rayleigh_layer_opd.txt: -------------------------------------------------------------------------------- 1 | # Differential Optical Thickness within atmospheric layers (US Standard Atmosphere) 2 | # Wavelength [um]: 0.325880 3 | # Total optical thickness [-]: 0.855166 4 | # Altitude [km]: 0.000 1.000 2.000 3.000 4.000 5.000 6.000 7.000 8.000 9.000 10.000 11.000 12.000 13.000 14.000 15.000 16.000 17.000 18.000 19.000 20.000 21.000 22.000 23.000 24.000 25.000 27.500 30.000 32.500 35.000 37.500 40.000 42.500 45.000 47.500 50.000 55.000 60.000 65.000 70.000 75.000 80.000 85.000 90.000 95.000 100.000 105.000 110.000 115.000 120.000 5 | # base_height tau_layer 6 | 0.0000000 9.63574461E-02 7 | 1.0000000 8.73580055E-02 8 | 2.0000000 7.89928868E-02 9 | 3.0000000 7.12620898E-02 10 | 4.0000000 6.41457921E-02 11 | 5.0000000 5.75845260E-02 12 | 6.0000000 5.15584689E-02 13 | 7.0000000 4.60279757E-02 14 | 8.0000000 4.09514190E-02 15 | 9.0000000 3.63169054E-02 16 | 10.000000 3.20947009E-02 17 | 11.000000 2.79061947E-02 18 | 12.000000 2.38564465E-02 19 | 13.000000 2.03874991E-02 20 | 14.000000 1.74220447E-02 21 | 15.000000 1.48907043E-02 22 | 16.000000 1.27300456E-02 23 | 17.000000 1.08825834E-02 24 | 18.000000 9.30272566E-03 25 | 19.000000 7.95280958E-03 26 | 20.000000 6.78724327E-03 27 | 21.000000 5.78223967E-03 28 | 22.000000 4.92788749E-03 29 | 23.000000 4.20337306E-03 30 | 24.000000 3.58827914E-03 31 | 25.000000 6.92649673E-03 32 | 27.500000 4.69299020E-03 33 | 30.000000 3.14881307E-03 34 | 32.500000 2.12349134E-03 35 | 35.000000 1.48619616E-03 36 | 37.500000 1.02532172E-03 37 | 40.000000 6.99389342E-04 38 | 42.500000 4.90261373E-04 39 | 45.000000 3.47390299E-04 40 | 47.500000 2.50557111E-04 41 | 50.000000 3.28757096E-04 42 | 55.000000 1.80742068E-04 43 | 60.000000 9.72494611E-05 44 | 65.000000 5.06367200E-05 45 | 70.000000 2.53500761E-05 46 | 75.000000 1.20709456E-05 47 | 80.000000 5.49382147E-06 48 | 85.000000 2.40308850E-06 49 | 90.000000 9.97074581E-07 50 | 95.000000 4.07650870E-07 51 | 100.00000 1.67728560E-07 52 | 105.00000 7.11332432E-08 53 | 110.00000 3.08518266E-08 54 | 115.00000 1.46706739E-08 55 | -------------------------------------------------------------------------------- /pyDISORT-master/test/test_Rayleigh.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """ 3 | Test of the Python wrapper to the DISORT library 4 | 5 | Module '_disort' is auto-generated with f2py (version:2). 6 | """ 7 | 8 | import numpy as np 9 | from pylab import plt 10 | import disort 11 | 12 | ########################################################################################################## 13 | 14 | if __name__ == '__main__': 15 | 16 | # read Rayleigh optical thickness for 325.8 nm [Ozone fitting window] 17 | xy = np.loadtxt('rayleigh_layer_opd.txt') 18 | dTau = xy[::-1,1] # FROM TOP TO BOTTOM 19 | z_atm = xy[::-1,0] # last altitude value missing, find in header 20 | z_atm = np.insert(z_atm, 0, 120.) 21 | 22 | N_tau = len(dTau) 23 | w0 = np.ones(N_tau)*1. 24 | iphas = np.ones(N_tau,dtype='int')*2 25 | gg = np.zeros(N_tau) 26 | 27 | cumTau = np.hstack([0.,dTau.cumsum()]) 28 | uTau = cumTau 29 | phi = np.array([0.,60.,120.]) 30 | umu0 = 1./np.sqrt(2.) 31 | fbeam = 1./umu0 # Ensures fluxes to be normalized to one 32 | phi0 = 0.0 33 | albedo = 0.1 34 | umu = np.array([-1.,-0.5,0.5,1.]) 35 | prnt = np.array([True, True, True, False, True]) 36 | 37 | [rfldir, rfldn, flup, dfdt, uavg, uu, albmed, trnmed] =\ 38 | disort.run(dTau, w0=w0, iphas=iphas, gg=gg, 39 | umu0=umu0, phi0=phi0, albedo=albedo, fbeam=fbeam, 40 | utau=uTau, umu=umu, phi=phi, prnt=prnt) 41 | 42 | rfltot = rfldir + rfldn 43 | print '\n# Energy conservation, R(TOA)+T(BOA)*(1-albedo) ~ 1: %.3f' % (flup[0] + rfltot[-1]*(1.-albedo)) 44 | 45 | plt.figure() 46 | plt.plot(rfltot, z_atm) 47 | 48 | plt.figure() 49 | plt.plot(flup, z_atm) 50 | -------------------------------------------------------------------------------- /pyDISORT-master/test/test_disort.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """ 3 | Test of the Python wrapper to the DISORT library 4 | 5 | Module '_disort' is auto-generated with f2py (version:2). 6 | """ 7 | 8 | import numpy as np 9 | import disort 10 | 11 | ########################################################################################################## 12 | 13 | if __name__ == '__main__': 14 | 15 | uTau = np.array([0.,1.]) 16 | phi = np.array([0.,60.,120.]) 17 | fbeam = 1. 18 | umu0 = 1./np.sqrt(2.) 19 | phi0 = 0.0 20 | albedo = 0.1 21 | umu = np.array([-1.,-0.5,0.5,1.]) 22 | 23 | # dTau = np.ones(50)*1./50 24 | # w0 = np.ones(50)*1. 25 | # iphas = np.ones(50,dtype='int')*2 26 | # gg = np.ones(50)*0.85 27 | 28 | # [rfldir, rfldn, flup, dfdt, uavg, uu, albmed, trnmed] =\ 29 | # disort.run(dTau, w0=w0, iphas=iphas, gg=gg, 30 | # umu0=umu0, phi0=phi0, albedo=albedo, fbeam=fbeam, 31 | # utau=uTau, umu=umu, phi=phi) 32 | 33 | # CASE IMPLEMENTED IN run_disort.f 34 | dTau = np.array([0.0, 0.0, 0.0, 1.0, 0.0, 0.0]) 35 | iphas = np.array([2, 2, 2, 3, 2, 2]) 36 | w0 = np.array([0.5, 0.5, 0.5, 0.899999976, 0.5, 0.5]) 37 | N = len(dTau) 38 | gg = np.ones(N)*0.85 39 | prnt = np.array([True, True, True, False, True]) 40 | 41 | [rfldir, rfldn, flup, dfdt, uavg, uu, albmed, trnmed] =\ 42 | disort.run(dTau, w0=w0, iphas=iphas, gg=gg, 43 | umu0=umu0, phi0=phi0, albedo=albedo, fbeam=fbeam, 44 | utau=uTau, umu=umu, phi=phi, prnt=prnt) 45 | 46 | print '\n\n' 47 | print '########################################### REFERENCE ###############################################' 48 | print '\n\n' 49 | print ' ****************************************************************************************************' 50 | print ' DISORT: Test Case No. 10a: like 9c, USRANG = True ' 51 | print ' ****************************************************************************************************' 52 | print '' 53 | print ' No. streams = 32 No. computational layers = 6' 54 | print ' 2 User optical depths : 0.0000 1.0000' 55 | print ' 4 User polar angle cosines : -1.00000 -0.50000 0.50000 1.00000' 56 | print ' 3 User azimuthal angles : 0.00 60.00 120.00' 57 | print ' No thermal emission' 58 | print ' Boundary condition flag: IBCND = 0' 59 | print ' Incident beam with intensity = 1.000E+00 and polar angle cosine = 0.70711 and azimuth angle = 0.00' 60 | print ' plus isotropic incident intensity = 0.000E+00' 61 | print ' Bottom albedo (Lambertian) = 0.1000' 62 | print ' Uses delta-M method' 63 | print ' Uses TMS/IMS method' 64 | print ' Calculate fluxes and intensities' 65 | print ' Relative convergence criterion for azimuth series = 0.00E+00' 66 | print '' 67 | print ' <------------- Delta-M --------------->' 68 | print ' Total Single Total Single' 69 | print ' Optical Optical Scatter Separated Optical Optical Scatter Asymm' 70 | print ' Depth Depth Albedo Fraction Depth Depth Albedo Factor' 71 | print ' 1 0.0000 0.0000 0.50000 0.00000 0.0000 0.0000 0.50000 0.0000' 72 | print ' 2 0.0000 0.0000 0.50000 0.00000 0.0000 0.0000 0.50000 0.0000' 73 | print ' 3 0.0000 0.0000 0.50000 0.00000 0.0000 0.0000 0.50000 0.0000' 74 | print ' 4 1.0000 1.0000 0.90000 0.00551 0.9950 0.9950 0.89950 0.8500' 75 | print ' 5 0.0000 1.0000 0.50000 0.00000 0.0000 0.9950 0.50000 0.0000' 76 | print ' 6 0.0000 1.0000 0.50000 0.00000 0.0000 0.9950 0.50000 0.0000' 77 | print '' 78 | print ' Number of Phase Function Moments = 33' 79 | print ' Layer Phase Function Moments' 80 | print ' 1 1.000000 0.000000 0.100000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000' 81 | print ' 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000' 82 | print ' 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000' 83 | print ' 0.000000 0.000000 0.000000' 84 | print ' 2 1.000000 0.000000 0.100000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000' 85 | print ' 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000' 86 | print ' 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000' 87 | print ' 0.000000 0.000000 0.000000' 88 | print ' 3 1.000000 0.000000 0.100000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000' 89 | print ' 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000' 90 | print ' 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000' 91 | print ' 0.000000 0.000000 0.000000' 92 | print ' 4 1.000000 0.850000 0.722500 0.614125 0.522006 0.443705 0.377150 0.320577 0.272491 0.231617' 93 | print ' 0.196874 0.167343 0.142242 0.120906 0.102770 0.087354 0.074251 0.063113 0.053646 0.045599' 94 | print ' 0.038760 0.032946 0.028004 0.023803 0.020233 0.017198 0.014618 0.012425 0.010562 0.008977' 95 | print ' 0.007631 0.006486 0.005513' 96 | print ' 5 1.000000 0.000000 0.100000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000' 97 | print ' 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000' 98 | print ' 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000' 99 | print ' 0.000000 0.000000 0.000000' 100 | print ' 6 1.000000 0.000000 0.100000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000' 101 | print ' 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000' 102 | print ' 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000' 103 | print ' 0.000000 0.000000 0.000000' 104 | print '\n' 105 | print ' <----------------------- FLUXES ----------------------->' 106 | print ' Optical Compu Downward Downward Downward Upward Mean Planck d(Net Flux)' 107 | print ' Depth Layer Direct Diffuse Total Diffuse Net Intensity Source / d(Op Dep)' 108 | print '' 109 | print ' 0.0000 1 7.071E-01 1.192E-07 7.071E-01 8.424E-02 6.229E-01 9.523E-02 0.000E+00 5.983E-01' 110 | print ' 1.0000 4 1.719E-01 3.888E-01 5.607E-01 5.607E-02 5.046E-01 8.305E-02 0.000E+00 1.044E-01' 111 | print '\n' 112 | print ' ********* I N T E N S I T I E S *********' 113 | print '' 114 | print ' Polar Azimuth angles (degrees)' 115 | print ' Optical Angle' 116 | print ' Depth Cosine' 117 | print '' 118 | print ' 0.00 60.00 120.00' 119 | print ' 0.0000 -1.0000 0.000E+00 0.000E+00 0.000E+00' 120 | print ' -0.5000 0.000E+00 0.000E+00 0.000E+00' 121 | print ' 0.5000 4.465E-02 3.413E-02 2.211E-02' 122 | print ' 1.0000 2.149E-02 2.149E-02 2.149E-02' 123 | print '' 124 | print ' 0.00 60.00 120.00' 125 | print ' 1.0000 -1.0000 4.352E-02 4.352E-02 4.352E-02' 126 | print ' -0.5000 6.599E-01 7.163E-02 2.009E-02' 127 | print ' 0.5000 1.785E-02 1.785E-02 1.785E-02' 128 | print ' 1.0000 1.785E-02 1.785E-02 1.785E-02' 129 | -------------------------------------------------------------------------------- /pyrads/Absorption_Continuum.py: -------------------------------------------------------------------------------- 1 | from __future__ import division, print_function, absolute_import 2 | import numpy as np 3 | from . import phys 4 | 5 | ''' 6 | Implement functions that return absorption cross-sections 7 | for various modes of continuum absorption. 8 | ''' 9 | 10 | 11 | ### 12 | # Implement fits from Pierrehumbert, PoPC. 13 | 14 | # Here: Water vapor self-continuum; Eqn. (4.91) 15 | # NOTE: 'wave' is a vector/matrix, T is a scalar 16 | # OTHER NOTE: Ray's values are at 100mbar of H2O. 17 | # I need to rescale them to whatever the actual partial pressure of H2O is. 18 | def get_H2OSelfContinuum(wave,T,pH2O,extrapolate=True): 19 | 20 | kappaC = np.zeros( wave.shape ) # kappa = 0 outside of region... 21 | 22 | mask = np.logical_and( wave>=500., wave<=1400. ) 23 | kappaC[mask] = np.exp(12.167-0.050898*wave[mask] + 8.3207e-05*wave[mask]**2 24 | -7.0748e-08*wave[mask]**3 + 2.3261e-11*wave[mask]**4) 25 | 26 | x = wave - 2500. 27 | mask = np.logical_and( wave>=2100., wave<=3000. ) 28 | kappaC[mask] = np.exp(-6.0055 + -0.0021363*x[mask] + 6.4723e-07*x[mask]**2 + 29 | -1.493e-08*x[mask]**3 + 2.5621e-11*x[mask]**4 + 30 | 7.328e-14*x[mask]**5) 31 | 32 | # just extrapolate the edges to ever higher/lower wavenumbers? 33 | if extrapolate: 34 | # extend left 35 | mask = wave < 500. 36 | kappa0 = np.exp(12.167-0.050898* 500. + 8.3207e-05* 500.**2 37 | -7.0748e-08* 500.**3 + 2.3261e-11* 500.**4) 38 | kappaC[mask] = kappa0 39 | 40 | # extend right 41 | mask = wave>3000. 42 | kappa1 = np.exp(-6.0055 + -0.0021363*(3000.-2500.) + 6.4723e-07*(3000.-2500.)**2 + 43 | -1.493e-08*(3000.-2500.)**3 + 2.5621e-11*(3000.-2500.)**4 + 44 | 7.328e-14*(3000.-2500.)**5) 45 | kappaC[mask] = kappa1 46 | 47 | # interpolate in between: 48 | mask = np.logical_and( wave>=1400., wave<=2100. ) 49 | kappa2 = np.exp(12.167-0.050898* 1400. + 8.3207e-05* 1400.**2 50 | -7.0748e-08* 1400.**3 + 2.3261e-11* 1400.**4) 51 | kappa3 = np.exp(-6.0055 + -0.0021363*(2100.-2500.) + 6.4723e-07*(2100.-2500.)**2 + 52 | -1.493e-08*(2100.-2500.)**3 + 2.5621e-11*(2100.-2500.)**4 + 53 | 7.328e-14*(2100.-2500.)**5) 54 | #kappaC[mask] = kappa2 + (kappa3 - kappa2) * (wave[mask] - 1400.)/(2100. - 1400.) # a) linear 55 | 56 | kappaC[mask] = 10**(np.log10(kappa2) + (np.log10(kappa3) - np.log10(kappa2)) * (wave[mask] - 1400.)/(2100. - 1400.)) # b) logarithmic 57 | 58 | 59 | # Temperature dependence & rescale for partial pressure: 60 | Tfac = (296./T)**4.25 61 | return kappaC *Tfac *(pH2O/1e4) 62 | -------------------------------------------------------------------------------- /pyrads/Absorption_Continuum.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielkoll/PyRADS-shortwave/9d86f7dc07bef37f832949a584f0abe2fd3b72c4/pyrads/Absorption_Continuum.pyc -------------------------------------------------------------------------------- /pyrads/Absorption_Continuum_MTCKD.py: -------------------------------------------------------------------------------- 1 | from __future__ import division, print_function, absolute_import 2 | import os 3 | import numpy 4 | from . import phys 5 | import time 6 | 7 | ''' 8 | A number of utilities to run the stand-alone MT_CDK continuum using python. 9 | dkoll (07.11.2017) 10 | 11 | UPDATE: (27.01.2018) 12 | Fixed the scaling in 'get_H2OContinuum'. 13 | Tau computed with these coefficients now matches tau natively computed by MTCKD. 14 | 15 | UPDATE: (29.01.2018) 16 | To allow these scripts to run parallel within the same dir, 17 | create all input/output files within a dummy directory. 18 | For a unique directory label, use time.time() stamp. 19 | ''' 20 | 21 | 22 | ### ----------------------------------- 23 | ### Global definitions here 24 | 25 | datapath = '/'.join( os.path.abspath(__file__).split('/')[:-2] ) + '/DATA/MT_CKD_continuum/' 26 | 27 | mtckd_exe_earthlike = datapath + "cntnm/cntnm_v3.2_OS_X_gnu_dbl" 28 | mtckd_exe_N2N2 = datapath + "cntnm.N2N2only/cntnm_v3.2_OS_X_gnu_dbl" 29 | mtckd_exe_H2O_N2 = datapath + "cntnm.H2O_N2/cntnm_v3.2_OS_X_gnu_dbl" 30 | mtckd_exe_H2O_N2_foreign = datapath + "cntnm.H2O_N2.foreign_only/cntnm_v3.2_OS_X_gnu_dbl" 31 | mtckd_exe_H2O_N2_self = datapath + "cntnm.H2O_N2.self_only/cntnm_v3.2_OS_X_gnu_dbl" 32 | 33 | mtckd_exe_default = mtckd_exe_H2O_N2 # ! 34 | 35 | 36 | ### ----------------------------------- 37 | ### Given wavenumber, (T,p,q), return total specific absorption crosssection for 38 | ### continuum. Include both H2O self-continuum plus N2-H2O continuum. 39 | ### 40 | ### INPUT: wave -> VECTOR; p,T,q -> SCALARS! 41 | ### 42 | ### OUTPUT: kappa, units = m2/kg 43 | ### Note: Assume input is in MKS! 44 | ### 45 | # From MTCKD: 46 | # "the self-continuum scales as ( Rself/Ro ) 47 | # the foreign continuum scales as ( (Rtot-Rself)/Ro ) 48 | # where R is the density rho [ R = (P/Po)*(To/T) ]." 49 | # 50 | # Also see Shine et al (2016), Eqn.1 (?) 51 | # 52 | ### CAREFUL: 53 | ### even though the above suggest that I should rescale using rho_i, I'm rescaling using p_i. 54 | ### this is the only way I can get tau from this kappa to match up with the tau computed by MTCKD. 55 | ### --> check to see how source code is doing this! 56 | 57 | def get_H2OContinuum(wave,T,p_tot,p_H2O,exe_file=None): 58 | # get crosssections MTCKD's 'pre-defined' (I'd have to change MTCKD code) spectral grid 59 | # Note: convert pressure in [Pa] to [mbar=hPa] 60 | # NOTE: the coefs are actually independent of pressure,pathlength,vmr! 61 | wave0,cross_self,cross_foreign = get_coefficients(p_tot/1e2,T,pathlength=0.,vmr_h2o=0.,exe_file=exe_file) 62 | 63 | kappa_self0 = cross_self * 0.1 * phys.N_avogadro/phys.H2O.MolecularWeight 64 | kappa_foreign0 = cross_foreign * 0.1 * phys.N_avogadro/phys.H2O.MolecularWeight # here: also m_H2O 65 | 66 | # Combine coefficients. Apply rescaling here. 67 | kappa0 = kappa_self0 * (p_H2O/p_tot) + kappa_foreign0 * ((p_tot-p_H2O)/p_tot) # self + foreign broadening 68 | 69 | # Now rescale for p,T 70 | # (test passed: without this scaling, can't match MTCKD's optical depths at T>>296K. with, it can.) 71 | kappa0 = kappa0 * (p_tot/1.013e5)*(296./T) 72 | 73 | # now interpolate to whatever wavenumbers I want: 74 | kappa = numpy.interp( wave, wave0,kappa0, left=numpy.nan,right=numpy.nan ) 75 | 76 | return kappa 77 | 78 | 79 | ### ----------------------------------- 80 | ### Given wavenumber, (T,p,q), return total optical depth for 81 | ### continuum. Include both H2O self-continuum plus N2-H2O continuum. 82 | ### 83 | ### INPUT: wave -> VECTOR; p,T,q -> SCALARS! 84 | ### 85 | ### OUTPUT: tau. 86 | ### Assume input is in MKS! 87 | 88 | def get_tau_H2OContinuum(wave,T,p_tot,p_h2o,q,params): 89 | 90 | R_mean = (1.-q)*params.R + q*params.Rv 91 | rho = p_tot / (T * R_mean) 92 | pathlength = p_tot / (rho * params.g) # assume hydrostatic ... 93 | vmr_h2o = p_h2o/p_tot 94 | 95 | ### QUESTION: is path the total path, or scaled for particular constituent only? 96 | wave0,tau0 = get_tau(p_tot/1e2,T,pathlength*1e2,vmr_h2o) # note: need [cm],[mbar] 97 | 98 | # now interpolate to whatever wavenumbers I want: 99 | tau = numpy.interp( wave, wave0,tau0, left=numpy.nan,right=numpy.nan ) 100 | 101 | return tau 102 | 103 | 104 | 105 | 106 | 107 | ### ----------------------------------- 108 | ### Given temperature & pressure, return absorption coefficients 109 | ### 110 | ### INPUT: p,T 111 | ### OUTPUT: kappa_self, kappa_foreign 112 | ### 113 | def get_coefficients(p,T,pathlength,vmr_h2o,exe_file=None,clean_files=True): 114 | 115 | if exe_file==None: 116 | exe_file = mtckd_exe_default 117 | 118 | # 119 | stamp = time.time() 120 | tmp_dir = "./tmp_mtckd_%.5f" % stamp # create a unique tmp dir 121 | os.mkdir( tmp_dir ) 122 | os.chdir( tmp_dir ) 123 | #print "current working directory: ",os.getcwd() 124 | 125 | run_mtckd(p,T,pathlength,vmr_h2o,exe_file) 126 | wave,kappa_self,kappa_foreign = read_mtckd_output("WATER.COEF") 127 | 128 | os.chdir('..') # back to initial dir 129 | #print "current working directory: ",os.getcwd() 130 | 131 | # 132 | if clean_files: 133 | os.remove( tmp_dir + '/INPUT') # clean up tmp files 134 | os.remove( tmp_dir + '/WATER.COEF') 135 | os.remove( tmp_dir + '/CNTNM.OPTDPT') 136 | os.rmdir( tmp_dir ) 137 | 138 | return wave,kappa_self,kappa_foreign 139 | 140 | 141 | ### ----------------------------------- 142 | ### Given temperature & pressure, return optical depth 143 | ### 144 | ### INPUT: p,T 145 | ### OUTPUT: tau 146 | ### 147 | def get_tau(p,T,pathlength,vmr_h2o,exe_file=None,clean_files=True): 148 | 149 | if exe_file==None: 150 | exe_file = mtckd_exe_default 151 | 152 | # 153 | stamp = time.time() 154 | tmp_dir = "./tmp_mtckd_%.5f" % stamp # create a unique tmp dir 155 | os.mkdir( tmp_dir ) 156 | os.chdir( tmp_dir ) 157 | 158 | run_mtckd(p,T,pathlength,vmr_h2o,exe_file) 159 | wave,tau = read_mtckd_output("CNTNM.OPTDPT") 160 | 161 | os.chdir('..') # back to initial dir 162 | # 163 | 164 | if clean_files: 165 | os.remove( tmp_dir + '/INPUT') # clean up tmp files 166 | os.remove( tmp_dir + '/WATER.COEF') 167 | os.remove( tmp_dir + '/CNTNM.OPTDPT') 168 | os.rmdir( tmp_dir ) 169 | 170 | return wave,tau 171 | 172 | 173 | 174 | 175 | 176 | ### ----------------------------------- 177 | ### Run MTCKD for given input parameters 178 | ### 179 | ### Note: mt_ckd needs [p] = mb, [path] = cm. 180 | ### 181 | 182 | def run_mtckd(p,T,pathlength,vmr_h2o,exe_file,suppress_stdout=True): 183 | 184 | input_file = "./INPUT" 185 | f = open(input_file,'w') 186 | f.write( "%.5f\n" % p ) 187 | f.write( "%.5f\n" % T ) 188 | f.write( "%.5f\n" % pathlength ) 189 | f.write( "%.5f\n" % vmr_h2o ) 190 | f.close() 191 | 192 | ## 193 | if suppress_stdout: 194 | os.system( exe_file + " < " + input_file + " > /dev/null") 195 | else: 196 | print( "================================================") 197 | print( "=== RUN MT_CKD CONTINUUM ===") 198 | print( "===") 199 | os.system( exe_file + " < " + input_file ) 200 | print( "===") 201 | print( "===") 202 | print( "================================================") 203 | 204 | 205 | ### ----------------------------------- 206 | ### Given output txt file, cut off header and extract data 207 | ### 208 | ### INPUT: 209 | ### need to specify which output file; 'WATER.COEF' vs 'CNTNM.OPTDPT' 210 | ### 211 | ### OUTPUT: 212 | ### if 'WATER.COEF', return wavenumber, self and foreign coefficients [units = cm2/molec] 213 | ### so, the coefficient convolved with radiation field 214 | ### if 'CNTNM.OPTDPT', return wavenumber and optical depth 215 | 216 | def read_mtckd_output(file): 217 | 218 | if file=="WATER.COEF": 219 | f = open(file,'r') 220 | txt = f.read() 221 | body = txt.split("MOLECULAR AMOUNTS (MOL/CM**2) BY LAYER \n")[-1] 222 | 223 | # note: genfromtxt needs to be fed a list of strings.. 224 | data = numpy.genfromtxt(body.split('\n'), skip_header=20) # careful about cutoffs! 225 | 226 | wave = data[:,0] 227 | kappa_self = data[:,3] 228 | kappa_foreign = data[:,4] 229 | return wave,kappa_self,kappa_foreign 230 | 231 | elif file=="CNTNM.OPTDPT": 232 | f = open(file,'r') 233 | txt = f.read() 234 | body = txt.split("MOLECULAR AMOUNTS (MOL/CM**2) BY LAYER \n")[-1] 235 | 236 | data = numpy.genfromtxt(body.split('\n'), skip_header=6) # careful about cutoffs! 237 | 238 | wave = data[:,0] 239 | tau = data[:,1] 240 | return wave,tau 241 | -------------------------------------------------------------------------------- /pyrads/Absorption_Continuum_MTCKD.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielkoll/PyRADS-shortwave/9d86f7dc07bef37f832949a584f0abe2fd3b72c4/pyrads/Absorption_Continuum_MTCKD.pyc -------------------------------------------------------------------------------- /pyrads/Absorption_Crosssections_HITRAN2016.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielkoll/PyRADS-shortwave/9d86f7dc07bef37f832949a584f0abe2fd3b72c4/pyrads/Absorption_Crosssections_HITRAN2016.pyc -------------------------------------------------------------------------------- /pyrads/Absorption_Crosssections_UV.py: -------------------------------------------------------------------------------- 1 | from __future__ import division, print_function, absolute_import 2 | import numpy as np 3 | from . import phys 4 | import os 5 | 6 | ''' 7 | Implement UV scattering cross-sections. 8 | Either data or fits. 9 | ''' 10 | 11 | ### ----------------------------------- 12 | ### Global definitions here 13 | 14 | 15 | ### ----------------------------------- 16 | ### Absorption crosssection for CO2 17 | ### based on eqn 6 in Venot+ (2013). 18 | 19 | def get_kappaAbs_CO2(wavenr,T): 20 | lam = 1e7 / wavenr # cm-1 -> nm 21 | 22 | # fitting formula: 23 | a = lambda T: -42.26 + (9593.*1.44/T) 24 | b = lambda T: 4.82e-3 - 61.5*1.44/T 25 | Q = lambda T: (1.-np.exp(-667.4*1.44/T))**(-2) * (1.-np.exp(-1388.2*1.44/T))**(-1) * (1.-np.exp(-2449.1*1.44/T))**(-1) 26 | 27 | sigma = Q(T) * np.exp(a(T)+b(T)*lam) 28 | kappaAbs = sigma * phys.N_avogadro/phys.CO2.MolecularWeight * 1e-1 # cm^2/molec -> m^2/kg 29 | return kappaAbs 30 | -------------------------------------------------------------------------------- /pyrads/Absorption_Crosssections_UV.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielkoll/PyRADS-shortwave/9d86f7dc07bef37f832949a584f0abe2fd3b72c4/pyrads/Absorption_Crosssections_UV.pyc -------------------------------------------------------------------------------- /pyrads/ClimateGraphics.py: -------------------------------------------------------------------------------- 1 | from __future__ import division, print_function, absolute_import 2 | #----------Section 3: Plotting utilities------------------------------- 3 | #These need to be localized, for systems that don't support Ngl 4 | # 5 | #This is imported into ClimateUtilities. If you want to use a 6 | #different graphics package (e.g. MatPlotLib) as a graphics driver 7 | #in place of Ngl, you only need to rewrite this module. The most 8 | #important thing to rewrite is the plot(...) function, which takes 9 | #a Curve object as input and produces a line plot. The plot(...) 10 | #function returns a plotObj object to allow further manipulation 11 | #(mostly saving the plot in various formats), but if you have a plotting 12 | #package that provides other ways of saving the plots, or if you just 13 | #want to save the plots by doing screen dumps, you can just have 14 | #the plot(...) function return None, or some dummy object. 15 | # 16 | #The other main function to customize is contour(...) which produces 17 | #contour plots of an array. This function is not very extensively 18 | #used in the courseware, so it is a lower priority for modification. 19 | #----------------------------------------------------------------------- 20 | 21 | 22 | #Note: On some older installations, Ngl has to 23 | #be imported as PyNGL instead of Ngl. If there 24 | #is a trouble with the import, fiddle with that. 25 | try: 26 | import Ngl 27 | except: 28 | try: 29 | import PyNGL as Ngl 30 | except: 31 | print( "PyNGL was not found on your system.") 32 | print( "You will not be able to use graphics functions.") 33 | print( "PyNGL is available for Mac OSX,Linux and Windows/CygWin") 34 | print( "Alternately, modify the module ClimateGraphics.py") 35 | print( "to use some other graphics driver") 36 | raise('Graphics Import Error') 37 | 38 | #A dummy class useful for passing parameters. 39 | #Just make an instance, then add new members 40 | #at will. Not sure why it also has to be defined 41 | #here, since it is also defined in ClimateUtilities, 42 | #but it seems to be necessary 43 | class Dummy: 44 | pass 45 | 46 | # A little class to make resources for Ngl plot options 47 | class resource: 48 | def __init__(self): 49 | self.trYReverse = False 50 | self.trXReverse = False 51 | self.trXLog = False 52 | self.trYLog = False 53 | self.nglFrame = False 54 | self.nglDraw = False 55 | #ToDo: Missing data code resource, line styles, line colors 56 | 57 | # A little class for use as a return object from plot(), so 58 | # the user has an easy way to delete a window or save a plot 59 | # to an eps file. 60 | class plotObj: 61 | def __init__(self,workstation,plot,WorkstationResources=None): 62 | self.workstation = workstation 63 | self.plot = plot 64 | self.WorkstationResources = WorkstationResources 65 | #Deletes a plot window 66 | def delete(self): 67 | Ngl.destroy(self.workstation) 68 | def save(self,filename = 'plot'): 69 | #'eps' workstation doesn't work reliably, but 'ps' is OK 70 | weps = Ngl.open_wks('ps',filename,self.WorkstationResources) 71 | Ngl.change_workstation(self.plot,weps) 72 | Ngl.draw(self.plot) 73 | Ngl.change_workstation(self.plot,self.workstation) 74 | Ngl.destroy(weps) 75 | 76 | #ToDo: 77 | # *Implement use of missing data coding. 78 | # *Provide some way to re-use window (e.g. by 79 | # returning w, and having it be an optional 80 | # argument. How to clear a window for re-use? 81 | # *Make some use of dashed lines in line styles 82 | # *The behavior of axis options like reverseX and 83 | # XlogAxis is confusing when switchXY = True. We 84 | # need to think about the semantics of what we 85 | # mean by the "X" axis, and stick to it. As 86 | # currently implemented the "X" axis means the 87 | # horizontal axis for these options. (However, 88 | # the semantics is different for the labeling options!) 89 | # If we change this (and we probably should), the 90 | # scripts plotting soundings will also need to be changed. 91 | # as well as the Workbook intructions and problem sets. 92 | # 93 | lineColors =range(3,203,20)+range(3,203,20) 94 | #Line colors for old versions of Ngl 95 | #lineColors =range(3,16)+range(3,16) 96 | lineThickness = [2,3,4,2,3,4,2,3,4,2,3,4,2,3,4,2,3,4,2,3,4] 97 | plotSymbols = [1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5] 98 | def plot(c): 99 | r = resource() 100 | r.trYReverse = c.reverseY 101 | r.trXReverse = c.reverseX 102 | r.trXLog = c.XlogAxis 103 | r.trYLog = c.YlogAxis 104 | # 105 | #Line styles 106 | r.xyLineColors = lineColors 107 | r.xyLineThicknesses = lineThickness 108 | #Plot title 109 | r.tiMainString = c.PlotTitle 110 | #Axis labels (ToDo: add defaults) 111 | #X and Y axis labels 112 | r.tiXAxisString = c.Xlabel 113 | r.tiYAxisString = c.Ylabel 114 | if c.switchXY: 115 | r.tiXAxisString,r.tiYAxisString = r.tiYAxisString,r.tiXAxisString 116 | 117 | # Legends, for multicurve plot 118 | legends = [] 119 | for id in c.listVariables(): 120 | if not id == c.Xid: 121 | if len(c.label[id]) > 0: 122 | legends.append(c.label[id]) 123 | else: 124 | legends.append(id) 125 | #ToDo: Add option to skip legends 126 | #Legends are redundant if there's only one curve 127 | if len(legends) > 1: 128 | r.pmLegendDisplayMode = "Always" 129 | r.xyExplicitLegendLabels = legends 130 | # 131 | #Suppress line drawing and just plot symbol for scatter plot curves 132 | r.xyMarkers = plotSymbols 133 | r.xyMarkerColors = lineColors 134 | r.xyMarkerSizeF = .01 135 | r.xyMarkLineModes = [] 136 | for id in c.listVariables(): 137 | if not id == c.Xid: 138 | if c.scatter[id]: 139 | r.xyMarkLineModes.append('Markers') 140 | else: 141 | r.xyMarkLineModes.append('Lines') 142 | # 143 | w = Ngl.open_wks('x11','Climate Workbook') 144 | if c.switchXY: 145 | plot = Ngl.xy(w,c.Y(),c.X(),r) 146 | else: 147 | plot = Ngl.xy(w,c.X(),c.Y(),r) 148 | # 149 | #Now draw the plot 150 | r.nglDraw = True 151 | Ngl.panel(w,[plot],[1,1],r) 152 | return plotObj(w,plot) #So that user can delete window or save plot 153 | 154 | # A basic contour plotter, which will plot a contour plot 155 | # of a Numeric array. The x and y scales can optionally 156 | # be specified using keyword arguments x and y. For example, 157 | # if we want the x scale to be the array (or list) lat, and 158 | # the y scale to be the array (or list) lon, we would call 159 | # contour as contour(A,x=lat,y=lon). 160 | def contour(A,**kwargs): 161 | #The following allows an expert user to pass 162 | #Ngl options directly to the plotter. 163 | #ToDo: Note that 164 | #options explicitly specified later will over-ride 165 | #what the user specified. This should be fixed, 166 | #by checking for things already specified. We should 167 | #also allow for using this resource to specify a color 168 | #map. 169 | if 'resource' in kwargs.keys(): 170 | r = kwargs['resource'] 171 | else: 172 | r = Dummy() 173 | # 174 | r.cnFillOn = True #Uses color fill 175 | # Set axes if they have been specified 176 | # as keyword arguments 177 | if 'x' in kwargs.keys(): 178 | r.sfXArray = kwargs['x'] 179 | if 'y' in kwargs.keys(): 180 | r.sfYArray = kwargs['y'] 181 | # 182 | # Now create the plot 183 | 184 | rw = Dummy() 185 | #Set the color map 186 | if 'colors' in kwargs.keys(): 187 | if (kwargs['colors'] == 'gray') or (kwargs['colors'] == 'grey') : 188 | #Set the default greyscale 189 | rw.wkColorMap = 'gsdtol' 190 | else: 191 | rw.wkColorMap = kwargs['colors'] 192 | else: 193 | #Default rainbow color table 194 | rw.wkColorMap = "temp1" 195 | 196 | w = Ngl.open_wks('x11','Climate Workbook',rw) 197 | r.nglDraw = False 198 | r.nglFrame = False 199 | plot = Ngl.contour(w,A,r) 200 | #Now draw the plot 201 | r.nglDraw = True 202 | Ngl.panel(w,[plot],[1,1],r) 203 | return plotObj(w,plot,rw) #So user can delete or save plot 204 | -------------------------------------------------------------------------------- /pyrads/ClimateGraphicsMPL.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielkoll/PyRADS-shortwave/9d86f7dc07bef37f832949a584f0abe2fd3b72c4/pyrads/ClimateGraphicsMPL.pyc -------------------------------------------------------------------------------- /pyrads/ClimateUtilities.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielkoll/PyRADS-shortwave/9d86f7dc07bef37f832949a584f0abe2fd3b72c4/pyrads/ClimateUtilities.pyc -------------------------------------------------------------------------------- /pyrads/DummyGraphics.py: -------------------------------------------------------------------------------- 1 | from __future__ import division, print_function, absolute_import 2 | #----------Section 3: Plotting utilities------------------------------- 3 | #This is a dummy graphics routine, to import if a graphics driver 4 | #is not found. It is the fallback import if the import of ClimateGraphics 5 | #fails in ClimateUtilities. This dummy routine allows courseware 6 | #scripts to be run without the user needing to comment out plot commands. 7 | #It also can be used as a template for customizing the plotter interface 8 | #to work with you locally favored Python graphics driver (e.g. MatPlotLib). 9 | #----------------------------------------------------------------------= 10 | 11 | #A dummy class useful for passing parameters. 12 | #Just make an instance, then add new members 13 | #at will. Not sure why this also has to be defined 14 | #here, since it's defined in ClimateUtilities, but 15 | #it seems to be necessary 16 | class Dummy: 17 | pass 18 | 19 | # A little class to make resources for Ngl plot options 20 | class resource: 21 | def __init__(self): 22 | self.trYReverse = False 23 | self.trXReverse = False 24 | self.trXLog = False 25 | self.trYLog = False 26 | self.nglFrame = False 27 | self.nglDraw = False 28 | #ToDo: Missing data code resource, line styles, line colors 29 | 30 | # A little class for use as a return object from plot(), so 31 | # the user has an easy way to delete a window or save a plot 32 | # to an eps file. 33 | class plotObj: 34 | def __init__(self,workstation,plot,WorkstationResources = None): 35 | self.workstation = workstation 36 | self.plot = plot 37 | self.WorkstationResources = WorkstationResources 38 | #Deletes a plot window 39 | def delete(self): 40 | #Deletes a plot window, cleans up 41 | pass 42 | def save(self,filename = 'plot'): 43 | #Saves a plot to a file 44 | pass 45 | 46 | #Makes a line pot from a Curve object 47 | def plot(c): 48 | print( "Plotting not implemented") 49 | #Set axis options according to information 50 | #in the curve object c. 51 | # 52 | #c.reverseY: 53 | # if True, reverse the Y axis 54 | #c.reverseX: 55 | # if True, reverse the X axis 56 | #c.XlogAxis: 57 | # if True, use a logarithmic X axis 58 | #c.YlogAxis: 59 | # if True, use a logarithmic Y axis 60 | # 61 | #Customize Line styles and colors here 62 | # 63 | #Set thePlot title 64 | #c.PlotTitle: 65 | # String containing the plot title 66 | #Axis labels 67 | #X and Y axis labels 68 | #c.Xlabel: 69 | # String containing the X axis label 70 | #c.Ylabel: 71 | # String containing the Y axis label 72 | # 73 | #Interchange the X and Y axes 74 | if c.switchXY: 75 | pass 76 | #If True, exchang the axes 77 | 78 | # Legends, for multicurve plot 79 | legends = [] 80 | for id in c.listVariables(): 81 | if not id == c.Xid: 82 | if len(c.label[id]) > 0: 83 | legends.append(c.label[id]) 84 | else: 85 | legends.append(id) 86 | 87 | # 88 | #Suppress line drawing and just plot symbol for scatter plot curves 89 | #Customize plotting symbols and marker sizes if desired 90 | for id in c.listVariables(): 91 | if not id == c.Xid: 92 | if c.scatter[id]: 93 | #If True, treat this data column as a scatter 94 | #plot and don't draw lines 95 | pass 96 | else: 97 | #If False, draw lines (default) 98 | pass 99 | # 100 | #Initialize the plot window here, if necessary. 101 | #w is the handle to the plot window 102 | w = None 103 | if c.switchXY: 104 | #Put in the command for doing the line plot here 105 | #Do the plot with the X and Y axes in the usual 106 | #order 107 | pass 108 | else: 109 | #Put in the command for doing the line plot here, 110 | #but switch the order of the axes. 111 | pass 112 | # 113 | #Now draw the plot 114 | #Depending on your graphics software, the preceding 115 | #command may already have drawn the plot. In some graphics 116 | #packages, after the plot is created, another command needs 117 | #to be executed in orter to display it. Either way, the 118 | #variable plotHandle below is a handle referring to the plot. 119 | #It is used to build a plotObj that can be used for further 120 | #manipulation of the plot such as saving or deleting. In some 121 | #graphics packages, which give control over such things from 122 | #menus in the plot window, the use of a plotObj for this may 123 | #be unnecessary. 124 | plotHandle = None 125 | return plotObj(w,plotHandle) #So that user can delete window or save plot 126 | 127 | # A basic contour plotter, which will plot a contour plot 128 | # of a numpy array. The x and y scales can optionally 129 | # be specified using keyword arguments x and y. For example, 130 | # if we want the x scale to be the array (or list) lat, and 131 | # the y scale to be the array (or list) lon, we would call 132 | # contour as contour(A,x=lat,y=lon). 133 | def contour(A,**kwargs): 134 | print( "Plotting not implemented") 135 | #The following allows an expert user to pass 136 | # options directly to the plotter. 137 | if 'resource' in kwargs.keys(): 138 | r = kwargs['resource'] 139 | else: 140 | r = Dummy() 141 | # 142 | r.cnFillOn = True #Use color fill 143 | 144 | if 'x' in kwargs.keys(): 145 | #Set the X array for the contour plot 146 | XArray = kwargs['x'] 147 | if 'y' in kwargs.keys(): 148 | #Set the Y array for the contour plot 149 | YArray = kwargs['y'] 150 | # 151 | # Now create the plot 152 | rw = Dummy() 153 | #Set the color map 154 | if 'colors' in kwargs.keys(): 155 | if (kwargs['colors'] == 'gray') or (kwargs['colors'] == 'grey') : 156 | #Set the default greyscale 157 | #(Substitute the appropriate command for your driver) 158 | rw.wkColorMap = 'gsdtol' 159 | else: 160 | rw.wkColorMap = kwargs['colors'] 161 | else: 162 | #Default rainbow color table 163 | rw.wkColorMap = "temp1" 164 | 165 | #Open/initialize a plot window 166 | w = None 167 | #Make the plot. plotHandle is the handle returned 168 | #by the plotter, used for further manipulation of the 169 | #plot. (Redundant for some kinds of plotting packages) 170 | plotHandle = None 171 | #Now draw the plot, if your driver needs this as a separate step 172 | #(Insert command for drawing the plot here, e.g. 173 | #ShowPlot(plotHandle). 174 | # 175 | #Return a plotObj with the necessary data for further 176 | #manipulation. 177 | return plotObj(w,plotHandle,rw) #So user can delete or save plot 178 | -------------------------------------------------------------------------------- /pyrads/Get_Fluxes.py: -------------------------------------------------------------------------------- 1 | from __future__ import division, print_function, absolute_import 2 | import numpy as np 3 | from . import phys 4 | 5 | from .Planck import Planck_n 6 | 7 | # Here: choose integrator 8 | from scipy.integrate import trapz as numint 9 | ##from scipy.integrate import simps as numint 10 | 11 | 12 | #### 13 | # Transmission function between level i and j 14 | def trans(i,j,tau): 15 | return np.exp( -np.abs(tau[i,:] - tau[j,:]) ) 16 | 17 | # Upward flux at level i (returns all spectral intervals) 18 | # Implements eqn.(4.12) in PoPC. 19 | # 20 | # INPUT: 21 | # 'data' object with following fields attached 22 | # B,tau - 2D matrices, dimensions pressure x wavenumber 23 | # B_surf - 1D matrix, 1 x wavenumber 24 | # 25 | # B,B_surf is emission, pi*Planck(T,nu) 26 | # tau is the optical depth 27 | # 28 | # OUTPUT: 29 | # upwards thermal flux, 1 x wavenumber 30 | # 31 | # Notes: 32 | # A[slice(i,None)] returns A[i:] 33 | # trans(i,slice(i,None)) is the transmission function between i-th level down to surface level 34 | # B[i:,:] is the emission between i-th level down to surface 35 | 36 | def Fplus(i,data): 37 | return data.B[i,:] + (data.B_surf-data.B[-1,:])*trans(i,-1,data.tau) + \ 38 | numint( trans(i,slice(i,None),data.tau ),x=data.B[i:,:],axis=0 ) 39 | 40 | 41 | ### Implement eqn.(4.11) instead. 42 | ### Note the minus sign, which comes from Pierrehumbert's sign convention for tau. 43 | def Fplus_alternative(i,data): 44 | return data.B_surf*trans(i,-1,data.tau) - numint( data.B[i:,:],x=trans(i,slice(i,None),data.tau), axis=0) 45 | 46 | 47 | ### Compute exp(-tau) weighted vertical integrals. 48 | ### For feedback calculations, I need to compute atmospheric integrals like this: 49 | ### int_{0}^{surf} f(tau) exp(-tau) dtau 50 | ### where f(tau) = pi B(T(tau)) for OLR 51 | ### f(tau) = pi dB/dT(T(tau)) for the planck feedback etc. 52 | 53 | def integrate_over_tau(i,data,integrand): 54 | return -1.* numint( integrand[i:,:],x=trans(i,slice(i,None),data.tau), axis=0) 55 | -------------------------------------------------------------------------------- /pyrads/Get_Fluxes.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielkoll/PyRADS-shortwave/9d86f7dc07bef37f832949a584f0abe2fd3b72c4/pyrads/Get_Fluxes.pyc -------------------------------------------------------------------------------- /pyrads/Get_Fluxes_pyDISORT.py: -------------------------------------------------------------------------------- 1 | from __future__ import division, print_function, absolute_import 2 | import numpy as np 3 | from . import phys 4 | import disort 5 | 6 | ### ----------------------------------- 7 | ### HELPERS: 8 | 9 | # ... 10 | 11 | ### ----------------------------------- 12 | ### 13 | # Use pyDISORT to compute scattering. 14 | # 15 | # INPUT: 16 | # p, pressure at which we want to know fluxes, [0d,1d] 17 | # pres, pressure grid, 1d 18 | # temp, temperature grid, 1d 19 | # wave, wavenr grid, 1d 20 | # Tau, optical thickness, 2d [pressure x wavenr] 21 | # Omega, single scattering albedo, 2d [pressure x wavenr] 22 | # 23 | # OUTPUT: 24 | # 25 | # 26 | # USAGE: 27 | # 28 | # 29 | # --- 30 | # Notes: 31 | # Pydisort throws errors when tau becomes very large. 32 | # I think that's because fortran has fewer significant digits than numpy, 33 | # so num.truncation can lead to max(utau)>max(tau)... 34 | # --> truncate Tau,Omega input 35 | 36 | def get_fluxes(pres_output,pres,temp,wave,Tau,Omega,cosz,Lstar,alpha_surf, \ 37 | output_angle = None, 38 | N_streams=4,doThermal=False,Ts=None,sourceFn=None, \ 39 | UsrTau=None,UsrAng=None ): 40 | 41 | # --- 42 | # setup pyDISORT: 43 | params_disort = {} 44 | params_disort['verbose'] = 0 # 0 = suppress header 45 | 46 | # cosine of viewing zenith angle where to output the RT fields (Default: 1.) 47 | if output_angle is None: 48 | params_disort['umu'] = 1. 49 | else: 50 | params_disort['umu'] = output_angle # (CAREFUL: might have to be monotonically increasing?) 51 | 52 | # Output returned at computational or user-defined tau,angles? 53 | # (default: returns ouput at user-defined angles) 54 | # -> note: I haven't gotten the computational option to work.. 55 | if UsrTau is not None: 56 | params_disort['UsrTau'] = UsrTau 57 | if UsrAng is not None: 58 | params_disort['UsrAng'] = UsrAng 59 | 60 | # --- 61 | # if output is at user-defined levels: 62 | # define those levels 63 | if pres_output=="toa": 64 | # (if we only want TOA output) 65 | p = np.array([0.]) 66 | def get_utau(tau=None,p=None,pres=None): 67 | return np.array([0.]) 68 | elif pres_output=="input": 69 | # (output on input grid) 70 | p = pres 71 | def get_utau(tau,p=None,pres=None): 72 | utau = tau 73 | return utau 74 | else: 75 | # (output at user-defined pressures) 76 | # interpolate on log tau 77 | # at toa: tau=0-> -inf -> NaN with this method. manually fix 78 | # also can get utau>max(tau) because of round-off?? manually fix -> still crashes! 79 | p = pres_output 80 | def get_utau(tau,p,pres): 81 | utau = 10**( np.interp( p,pres,np.log10(tau) )) 82 | utau[np.isnan(utau)] = 0. 83 | return utau 84 | 85 | # --- 86 | params_disort['iphas'] = 2 # phase function: 1=isotropic, 2=rayleigh 87 | params_disort['gg'] = 0. # asymmetry parameter. =0 for Rayleigh 88 | params_disort['umu0'] = cosz 89 | params_disort['albedo'] = alpha_surf 90 | params_disort['Nstr'] = N_streams # number of streams -> ?? 91 | 92 | params_disort['ibcnd'] = 0 93 | 94 | # using spectrally resolved stellar source function? 95 | # need same dims as 'wave'! 96 | if sourceFn is not None: 97 | source = sourceFn(wave) 98 | else: 99 | source = wave*0. + Lstar 100 | 101 | 102 | # show more/less output? 103 | params_disort['prnt'] = np.array([False, False, False, False, False]) 104 | 105 | # include thermal emission? 106 | params_disort['plank'] = doThermal 107 | 108 | if doThermal: 109 | # careful about mid-level vs interfaces.. 110 | params_disort['temp'] = temp 111 | params_disort['btemp'] = Ts 112 | params_disort['temis'] = 0. # emissivity of top boundary 113 | params_disort['ttemp'] = 0. #Tstrat # doesn't matter if temis=0? 114 | 115 | # HERE: assume fixed dnu in wave grid!! 116 | dwave = np.diff(wave)[0] 117 | 118 | # --- 119 | # iterate over spectral grid: 120 | # cast p into array form, to deal with float input.. 121 | 122 | Idirect_grid = np.zeros( (len(np.array(p)),len(wave)) ) 123 | Iplus_grid = np.zeros( (len(np.array(p)),len(wave)) ) 124 | Iminus_grid = np.zeros( (len(np.array(p)),len(wave)) ) 125 | 126 | # -- 127 | for nu in wave: 128 | # ... 129 | if doThermal: 130 | params_disort['wvnmlo'] = nu - dwave/2. 131 | params_disort['wvnmhi'] = nu + dwave/2. 132 | 133 | # direct beam source: 134 | params_disort['fbeam'] = source[nu==wave] # (don't include cosz here!) 135 | 136 | # optical thickness: 137 | tau = np.squeeze(Tau[:,nu==wave]) # 1d 138 | 139 | # single scattering albedo: 140 | # careful: tau is computed from kappa via trapz rule -> apply same to omega! 141 | # i.e., int[f(x)dx] = sum [f(i+1)+f(i)]*0.5 * dx(i) 142 | omega = np.squeeze(Omega[:,nu==wave]) # 1d 143 | params_disort['w0'] = 0.5*(omega[0:-1] + omega[1:]) 144 | 145 | # 146 | params_disort['utau'] = get_utau(tau,p,pres) 147 | 148 | # 149 | dtau = np.diff(tau) 150 | 151 | # 152 | Idirect, Iminus, Iplus, dfdt, uavg, uu, albmed, trnmed = disort.run(dtau, **params_disort) 153 | 154 | Idirect_grid[:,nu==wave] = Idirect[:,np.newaxis] # cast into right shape.. 155 | Iplus_grid[:,nu==wave] = Iplus[:,np.newaxis] 156 | Iminus_grid[:,nu==wave] = Iminus[:,np.newaxis] 157 | 158 | if doThermal: 159 | # THERMAL EMISSION has units=W/m2. transform to W/m2/cm-1: 160 | Idirect_grid = Idirect_grid/dwave 161 | Iplus_grid = Iplus_grid/dwave 162 | Iminus_grid = Iminus_grid/dwave 163 | 164 | return Idirect_grid,Iplus_grid,Iminus_grid 165 | -------------------------------------------------------------------------------- /pyrads/Get_Fluxes_pyDISORT.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielkoll/PyRADS-shortwave/9d86f7dc07bef37f832949a584f0abe2fd3b72c4/pyrads/Get_Fluxes_pyDISORT.pyc -------------------------------------------------------------------------------- /pyrads/Merge_Spectral_Output.py: -------------------------------------------------------------------------------- 1 | from __future__ import division, print_function, absolute_import 2 | import numpy as np 3 | import glob 4 | 5 | 6 | ### ----------------------------------- 7 | ### Helpers 8 | class Dummy: 9 | pass 10 | 11 | # use this class to sum up over all spectral intervals: 12 | class Output_Angle: 13 | def __init__(self,zenith,p,T,q): 14 | self.zenith = zenith 15 | self.cosz = np.cos( zenith * np.pi/180. ) 16 | 17 | self.p = p 18 | self.T = T 19 | self.q = q 20 | self.SWdir = np.zeros_like(p) 21 | self.SWdn = np.zeros_like(p) 22 | self.SWup = np.zeros_like(p) 23 | 24 | def add_to_fluxes(self,SWdir,SWdn,SWup): 25 | self.SWdir += SWdir 26 | self.SWdn += SWdn 27 | self.SWup += SWup 28 | 29 | 30 | # --- 31 | def read_output(file): 32 | f = open(file,'r') 33 | txt = f.read() 34 | 35 | # files are arranged by zenith angle chunks: 36 | chunks = txt.split('wavenr_min,wavenr_max,dwave [cm^-1] =') 37 | 38 | angle_list = [] 39 | 40 | for chunk in chunks[1:]: 41 | # note: genfromtxt needs to be fed a list of strings.. 42 | data = np.genfromtxt( chunk.split('\n'), delimiter=',\t', skip_header=3 ) 43 | 44 | # get zenith angle: 45 | # is in 2nd line of each chunk 46 | zenith = float( chunk.split('\n')[1].split('zenith angle =')[-1] ) 47 | cosz = np.cos( zenith*np.pi/180. ) 48 | 49 | # save into a out object: 50 | out = Dummy() 51 | out.zenith = zenith 52 | out.cosz = cosz 53 | 54 | out.p = data[:,0] 55 | out.T = data[:,1] 56 | out.q = data[:,2] 57 | out.SWdir = data[:,3] 58 | out.SWdn = data[:,4] 59 | out.SWup = data[:,5] 60 | 61 | angle_list.append(out) 62 | 63 | return angle_list 64 | 65 | 66 | ### ----------------------------------- 67 | ### MAIN UTILITY FUNCTION: 68 | 69 | def merge_output(path,prefix='output',remove_out=False,remove_err=False): 70 | # if path doesn't end in '/', make sure if does: 71 | if path[-1] is not '/': 72 | path = path + '/' 73 | 74 | files = glob.glob( path + prefix + '*.txt' ) 75 | 76 | # get data from each spectral interval: 77 | spectral_list = [] 78 | for ff in files: 79 | x = read_output(ff) 80 | spectral_list.append( x ) 81 | 82 | # prepare output: 83 | # (p,T,q) should be same for all spectral intervals, so just pick any one. 84 | spec0 = spectral_list[-1] # pick any one 85 | N_angles = len(spec0) 86 | output_list = [Output_Angle(angle.zenith,angle.p,angle.T,angle.q) for angle in spec0] 87 | 88 | # to get net fluxes: add up all fluxes 89 | for i in range(N_angles): 90 | output = output_list[i] 91 | 92 | for spectral_interval in spectral_list: 93 | SWdir = spectral_interval[i].SWdir 94 | SWdn = spectral_interval[i].SWdn 95 | SWup = spectral_interval[i].SWup 96 | 97 | output.add_to_fluxes(SWdir,SWdn,SWup) 98 | 99 | # ** UNDER CONSTRUCTION ** 100 | # (remove std out/err files?) 101 | if remove_out: 102 | pass 103 | if remove_err: 104 | pass 105 | 106 | return output_list 107 | -------------------------------------------------------------------------------- /pyrads/Merge_Spectral_Output.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielkoll/PyRADS-shortwave/9d86f7dc07bef37f832949a584f0abe2fd3b72c4/pyrads/Merge_Spectral_Output.pyc -------------------------------------------------------------------------------- /pyrads/OpticalThickness.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielkoll/PyRADS-shortwave/9d86f7dc07bef37f832949a584f0abe2fd3b72c4/pyrads/OpticalThickness.pyc -------------------------------------------------------------------------------- /pyrads/Planck.py: -------------------------------------------------------------------------------- 1 | from __future__ import division, print_function, absolute_import 2 | import numpy as np 3 | from . import phys 4 | 5 | ### 6 | # Planck function (of frequency) 7 | # From Pierrehumbert - PoPC 8 | def Planck_nu(nu,T): 9 | u = phys.h*nu/(phys.k*T) 10 | u[u>500.] = 500. #To prevent overflow 11 | #return (2.*phys.h*nu**3/phys.c**2)/(np.exp(u)-1.) # [?] 12 | return 2.*(phys.k*T)**3/((phys.h*phys.c)**2) * u**3/(np.exp(u)-1.) 13 | 14 | def Planck_lambda(lam,T): 15 | u = phys.h*phys.c/(lam*phys.k*T) 16 | u[u>500.] = 500. #To prevent overflow 17 | return (2.*(phys.k*T)**5/(phys.h**4*phys.c**3)) * u**5/(np.exp(u)-1.) 18 | 19 | 20 | ## Based on Ray's book. 21 | ## NOTE: Returns the radiance in W/m2/stearadian / [length] 22 | ## where [length] is the unit in which I'm measuring the spectral axis. 23 | ## 24 | ## Conversion factor 'k' is necessary because Planck_lambda (above) returns 25 | ## W/m2/stearadian/m. 'k' allows me to return W/m2/stearadian/cm. 26 | def Planck_n(n,T,unit="cm^-1"): 27 | if unit=="m^-1": 28 | k = 1. 29 | elif unit=="cm^-1": 30 | n = n*100. 31 | k = 100. 32 | else: 33 | print( "(Planck_n) Error: unit not recognized!") 34 | return k*phys.c*Planck_nu(n*phys.c,T) 35 | 36 | 37 | 38 | ## ----------------------------------------------------------- 39 | ## BELOW: compute Brightness temperatures 40 | 41 | ## Get Brightness temperature from inverting Planck function: 42 | ## [lam] = m # wavelength 43 | ## [I] = W/m^2 / stearadian / m # intensity 44 | def Tbrightness_lambda(lam,I): 45 | return phys.h*phys.c / (phys.k*lam* np.log(2.*phys.h*phys.c**2/(I * lam**5) + 1.) ) 46 | 47 | ## [nu] = s^-1 = Hz # frequency 48 | ## [I] = W/m^2 / stearadian / Hz # intensity 49 | def Tbrightness_nu(nu,I): 50 | return phys.h * nu / (phys.k * np.log(2.*phys.h*nu**3/(phys.c**2 * I) + 1.) ) 51 | 52 | ## [n] = cm^-1 53 | ## [intensity] = W/m^2 / stearadian / cm^-1 54 | def Tbrightness_n(n,I,unit="cm^-1"): 55 | if unit=="m^-1": 56 | k = 1. 57 | elif unit=="cm^-1": 58 | n = n*100. 59 | k = 100. 60 | else: 61 | print( "(Planck_n) Error: unit not recognized!") 62 | 63 | return Tbrightness_nu(n*phys.c, I/(k*phys.c)) 64 | 65 | 66 | 67 | ## ----------------------------------------------------------- 68 | ## BELOW: compute derivative with respect to temperature 69 | 70 | def dPlanckdT_nu(nu,T): 71 | u = phys.h*nu/(phys.k*T) 72 | u[u>500.] = 500. #To prevent overflow 73 | return 2.*phys.h**2/(phys.k*phys.c**2) * (nu**4/T**2) * np.exp(u)/( (np.exp(u)-1.)**2 ) 74 | 75 | # note: assume 'n' is in cm^-1! 76 | def dPlanckdT_n(n,T,unit="cm^-1"): 77 | if unit=="m^-1": 78 | k = 1. 79 | elif unit=="cm^-1": 80 | k = 100. 81 | else: 82 | print( "(Planck_n) Error: unit not recognized!") 83 | 84 | return (k*phys.c) * dPlanckdT_nu( phys.c*n*k ,T) 85 | -------------------------------------------------------------------------------- /pyrads/Planck.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielkoll/PyRADS-shortwave/9d86f7dc07bef37f832949a584f0abe2fd3b72c4/pyrads/Planck.pyc -------------------------------------------------------------------------------- /pyrads/Scattering_Crosssections_Rayleigh.py: -------------------------------------------------------------------------------- 1 | from __future__ import division, print_function, absolute_import 2 | import numpy as np 3 | from . import phys 4 | import os 5 | 6 | ''' 7 | Implement Rayleigh scattering cross-sections. 8 | ''' 9 | 10 | ### ----------------------------------- 11 | ### Global definitions here 12 | 13 | #Path to the datasets 14 | datapath = '/'.join( os.path.abspath(__file__).split('/')[:-2] ) + '/DATA/' # ! 15 | goldblatt_tableS1 = datapath + "Goldblatt2013_archive_revised/Goldblatt_TableS1.csv" 16 | 17 | # # hard-code data? 18 | # wavelen = np.array([1.00E-02,1.50E-01,1.60E-01,1.70E-01,1.80E-01,1.90E-01,2.00E-01,2.10E-01,2.20E-01, 19 | # 2.30E-01,2.40E-01,2.50E-01,2.60E-01,2.70E-01,2.80E-01,2.90E-01,3.00E-01,3.10E-01, 20 | # 3.20E-01,3.30E-01,3.40E-01,3.50E-01,3.60E-01,3.70E-01,3.80E-01,3.90E-01,4.00E-01, 21 | # 4.10E-01,4.20E-01,4.30E-01,4.40E-01,4.50E-01,4.60E-01,4.70E-01,4.80E-01,4.90E-01, 22 | # 5.00E-01,5.10E-01,5.20E-01,5.30E-01,5.40E-01,5.50E-01,5.60E-01,5.70E-01,5.80E-01, 23 | # 5.90E-01,6.00E-01,6.10E-01,6.20E-01,6.30E-01,6.40E-01,6.50E-01,6.60E-01,6.70E-01, 24 | # 6.80E-01,6.90E-01,7.00E-01,7.10E-01,7.20E-01,7.30E-01,7.40E-01,7.50E-01,7.60E-01, 25 | # 7.70E-01,7.80E-01,7.90E-01,8.00E-01,8.10E-01,8.20E-01,8.30E-01,8.40E-01,8.50E-01, 26 | # 8.60E-01,8.70E-01,8.80E-01,8.90E-01,9.00E-01,9.10E-01,9.20E-01,9.30E-01,9.40E-01, 27 | # 9.50E-01,9.60E-01,9.70E-01,9.80E-01,9.90E-01,1.00E+00,1.10E+00,1.20E+00,1.30E+00, 28 | # 1.40E+00,1.50E+00,1.60E+00,1.70E+00,1.80E+00,1.90E+00,2.00E+00,3.00E+00,4.00E+00, 29 | # 5.00E+00,1.00E+01]) 30 | # cAir = ... 31 | # cH2O = ... 32 | 33 | 34 | ### ----------------------------------- 35 | ### Implement fits from Goldblatt et al (2013), Table S1 36 | # 37 | # Data are given as m^2/molecule. 38 | # careful: the description given in table caption doesn't match these units. 39 | # Linearly interpolate to get empirical constant 'c', then use analytical ~1/lambda^4. 40 | # 41 | # INPUT: 42 | # wave [NEED cm^-1!] 43 | # OUTPUT: 44 | # kappaSca_H2O [m^2/kg] 45 | # 46 | # NOTE: here, load table each time kappa is called. 47 | # NOTE 2: the eqn in Table S1 has an error '128*pi^{5/3}' -> '128*pi^{5}/3'! 48 | 49 | def get_KappaSca_H2O(wavenr): 50 | wavelen = 1e-2/wavenr # [cm^-1] -> [m] 51 | 52 | # read in data: 53 | data = np.genfromtxt(goldblatt_tableS1,skip_header=1,delimiter=',') 54 | 55 | wavelen_data = data[:,0] * 1e-6 # [micron] -> [m] 56 | cH2O_data = data[:,2] * phys.N_avogadro/phys.H2O.MolecularWeight*1e3 # [m^2/molecule] * (molec/mole*mole/g*g/kg) = [m^2/kg] 57 | 58 | cH2O = np.interp( wavelen, wavelen_data, cH2O_data ) 59 | kappaH2O = 128./3. *np.pi**5 *cH2O *(1./wavelen)**4. 60 | 61 | return kappaH2O 62 | 63 | 64 | def get_KappaSca_Air(wavenr): 65 | wavelen = 1e-2/wavenr # [cm^-1] -> [m] 66 | 67 | # read in data: 68 | data = np.genfromtxt(goldblatt_tableS1,skip_header=1,delimiter=',') 69 | 70 | wavelen_data = data[:,0] * 1e-6 # [micron] -> [m] 71 | cAir_data = data[:,1] * phys.N_avogadro/phys.air.MolecularWeight*1e3 # [m^2/molecule] * (molec/mole*mole/g*g/kg) = [m^2/kg] 72 | 73 | cAir = np.interp( wavelen, wavelen_data, cAir_data ) 74 | kappaAir = 128./3. *np.pi**5 *cAir *(1./wavelen)**4. 75 | 76 | return kappaAir 77 | 78 | 79 | ### ----------------------------------- 80 | ### Implements simple analytical formula from Dalgarno & Williams (1962), Eq.3: 81 | # Note: in their formulation, [lambda] = Angstrom! 82 | # Note: these values reproduce the crosssections in Table 5.2 in PoPC pretty well. 83 | 84 | def get_KappaSca_H2(wavenr): 85 | wavelen = 1e-2/wavenr # [cm^-1] -> [m] 86 | 87 | # for fit: [input]=A, [output]=cm^2 88 | get_sigma = lambda x: (8.14e-13/(x**4) + 1.28e-6/(x**6) + 1.61/(x**8) ) 89 | 90 | # [cm^2/molecule] * (molec/mole*mole/g) * (m^2/cm^2*g/kg) = [m^2/kg] 91 | kappaH2 = get_sigma(wavelen*1e10) * phys.N_avogadro/phys.H2.MolecularWeight *1e-1 92 | 93 | return kappaH2 94 | 95 | 96 | ### ----------------------------------- 97 | ### Implements fits to Rayleigh scattering for CO2 from PoPC! 98 | ### -> very simple fits 99 | 100 | def get_KappaSca_PoPC(wavenr,gasname): 101 | wavelength = 1e-2/wavenr # [cm^-1] -> [m] 102 | 103 | 104 | # / ------ / 105 | # scale data to given wavelength from 106 | # nearest reference point that is closest to the wavelength 107 | # / ------ / 108 | # Actually, the above takes much too long: 109 | # just pick the reference value for 1 micron 110 | 111 | # Reference value: H2 xsec at 1 micron 112 | wavelength0 = 1e-6 # [m] 113 | chi_per_mass0 = 2.49e-6 114 | 115 | x = wavelength / wavelength0 116 | if gasname == "H2": 117 | relative_chi = 1. 118 | relative_chi_per_mass = 1. 119 | elif gasname == "H2O": 120 | relative_chi = 3.3690 121 | relative_chi_per_mass = 0.3743 122 | elif gasname == "He": 123 | relative_chi = 0.0641 124 | relative_chi_per_mass = 0.0321 125 | elif gasname == "air": 126 | relative_chi = 4.4459 127 | relative_chi_per_mass = 0.3066 128 | elif gasname == "N2": 129 | relative_chi = 4.6035 130 | relative_chi_per_mass = 0.3288 131 | elif gasname == "O2": 132 | relative_chi = 3.8634 133 | relative_chi_per_mass = 0.2415 134 | elif gasname == "CO2": 135 | relative_chi = 10.5611 136 | relative_chi_per_mass = 0.4800 137 | elif gasname == "NH3": 138 | relative_chi = 7.3427 139 | relative_chi_per_mass = 0.8638 140 | elif gasname == "CH4": 141 | relative_chi = 10.1509 142 | relative_chi_per_mass = 1.2689 143 | else: 144 | print( "Gas not recognized!" ) 145 | 146 | kappa = chi_per_mass0 * relative_chi_per_mass / (x**4) 147 | 148 | return kappa 149 | -------------------------------------------------------------------------------- /pyrads/Scattering_Crosssections_Rayleigh.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielkoll/PyRADS-shortwave/9d86f7dc07bef37f832949a584f0abe2fd3b72c4/pyrads/Scattering_Crosssections_Rayleigh.pyc -------------------------------------------------------------------------------- /pyrads/SetupGrids.py: -------------------------------------------------------------------------------- 1 | ''' 2 | *********************************************************** 3 | This script setups the vertical and spectral grids. 4 | *********************************************************** 5 | ''' 6 | from __future__ import division, print_function, absolute_import 7 | import numpy as np 8 | from . import VerticalStructure 9 | from . import Thermodynamics 10 | 11 | # --- 12 | ## Helpers 13 | class Dummy: 14 | pass 15 | 16 | # --- 17 | ## Setup the grid (spectral, pressure) here. 18 | ## FOR A FIXED SURFACE TEMPERATURE. 19 | ## Put into a single object. 20 | 21 | def make_grid( Ts,Tstrat,N_press,wavenr_min,wavenr_max,dwavenr,params, \ 22 | pTOA_decade=-4, RH=1., adiabat="full" ): 23 | 24 | grid = Dummy() 25 | grid.Ts = Ts 26 | grid.ps = params.ps_dry + RH * params.esat(Ts) 27 | 28 | # setup constants 29 | grid.Np = N_press 30 | grid.n0, grid.n1, grid.dn = wavenr_min, wavenr_max, dwavenr 31 | 32 | # setup arrays 33 | grid.n = np.arange( grid.n0, grid.n1, grid.dn ) # 1d 34 | grid.wave = np.tile( grid.n,(grid.Np,1) ) # 2d 35 | grid.Nn = len(grid.n) 36 | 37 | # start filling arrays: compute p,T,q profiles 38 | # -> careful about starting pressure! 39 | # -> note: stratosphere only used for a full moist adiabat! 40 | 41 | grid.p = np.logspace( pTOA_decade,0,endpoint=True,num=grid.Np ) * grid.ps # 1d [Pa] 42 | if adiabat=="full": 43 | grid.T,grid.q = VerticalStructure.get_Tq_moist(grid.p,Ts,grid.ps,params,Tstrat=Tstrat,RH=RH) 44 | elif adiabat=="dry": 45 | grid.T = VerticalStructure.get_TofP_DryAdiabat(grid.p,Ts,grid.ps,params) 46 | grid.q = Thermodynamics.get_q(grid.T,grid.p,params,RH=RH) 47 | elif adiabat=="steam": 48 | grid.T = VerticalStructure.get_TofP_SingleCompAdiabat(grid.p,params) 49 | grid.q = grid.T * 0. + 1. 50 | else: 51 | print( "(setupgrids) error: adiabat choice=",adiabat, " -> not recognized! *****") 52 | 53 | return grid 54 | 55 | 56 | 57 | ## AGAIN, but now allow vertical resolution to vary with surface pressure! 58 | ## -> keep adding more points as pressure keeps rising to make sure resolution near TOA is fixed 59 | def make_grid_fixedTop( Ts,Tstrat,wavenr_min,wavenr_max,dwavenr,params, \ 60 | ptop=0.1, Npress_per_decade=6., RH=1., adiabat="full" ): 61 | 62 | grid = Dummy() 63 | grid.Ts = Ts 64 | grid.ps = params.ps_dry + RH * params.esat(Ts) 65 | 66 | # setup constants 67 | ptop = min( ptop,grid.ps*0.0002 ) # make sure ptop < ps 68 | grid.Np = int(round( (np.log10(grid.ps)-np.log10(ptop))*Npress_per_decade)) # 69 | grid.n0, grid.n1, grid.dn = wavenr_min, wavenr_max, dwavenr 70 | 71 | # setup arrays 72 | grid.n = np.arange( grid.n0, grid.n1, grid.dn ) # 1d 73 | grid.wave = np.tile( grid.n,(grid.Np,1) ) # 2d 74 | grid.Nn = len(grid.n) 75 | 76 | # start filling arrays: compute p,T,q profiles 77 | # -> careful about starting pressure! 78 | # 79 | # -> DISORT also needs temps at mid-points 80 | # say pmid[i] = p[i] + (p[i+1]-p[i])/2. 81 | # 82 | # beware: 83 | # roundoff can cause max(p) > ps. Make sure that doesn't happen. 84 | 85 | # --- 86 | # OLD: log spaced 87 | # grid.p = np.logspace( np.log10(ptop),np.log10(grid.ps),endpoint=True,num=grid.Np ) # 1d [Pa] 88 | 89 | # if max(grid.p) > grid.ps: 90 | # #grid.p = grid.p * grid.ps/max(grid.p) # fixes roundoff? (OLD) 91 | # grid.p = grid.p * 0.99999 * grid.ps/max(grid.p) # fixes roundoff? (NEW) 92 | 93 | # --- 94 | # NEW v2: log spaced; 2x resolution in last decade; 1.5x in the 2nd last 95 | Np1 = int(Npress_per_decade * 1.5) 96 | Np2 = int(Npress_per_decade * 2.) 97 | Np0 = grid.Np - (Np1+Np2) 98 | 99 | p0 = np.logspace( np.log10(ptop),np.log10(grid.ps)-2,endpoint=False,num=Np0 ) 100 | p1 = np.logspace( np.log10(grid.ps)-2,np.log10(grid.ps)-1,endpoint=False,num=Np1 ) 101 | p2 = np.logspace( np.log10(grid.ps)-1,np.log10(grid.ps),endpoint=True,num=Np2 ) 102 | grid.p = np.concatenate( (p0,p1,p2) ) * 0.99999 # 1d [Pa] 103 | # --- 104 | 105 | #grid.pmid = np.concatenate( (np.array([0.]),grid.p[0:-1] + np.diff(grid.p)/2.) ) 106 | grid.pmid = grid.p[0:-1] + np.diff(grid.p)/2. # NOTE: len(pmid) = len(p)-1! 107 | 108 | if adiabat=="full": 109 | grid.T,grid.q = VerticalStructure.get_Tq_moist(grid.p,Ts,grid.ps,params,Tstrat=Tstrat,RH=RH) 110 | grid.Tmid,tmp = VerticalStructure.get_Tq_moist(grid.pmid,Ts,grid.ps,params,Tstrat=Tstrat,RH=RH) 111 | elif adiabat=="dry": 112 | grid.T = VerticalStructure.get_TofP_DryAdiabat(grid.p,Ts,grid.ps,params) 113 | grid.q = Thermodynamics.get_q(grid.T,grid.p,params,RH=RH) 114 | grid.Tmid = VerticalStructure.get_TofP_DryAdiabat(grid.pmid,Ts,grid.ps,params) 115 | elif adiabat=="steam": 116 | grid.T = VerticalStructure.get_TofP_SingleCompAdiabat(grid.p,params) 117 | grid.q = grid.T * 0. + 1. 118 | grid.Tmid = VerticalStructure.get_TofP_SingleCompAdiabat(grid.pmid,params) 119 | else: 120 | print( "(setupgrids) error: adiabat choice=",adiabat, " -> not recognized! *****" ) 121 | 122 | return grid 123 | -------------------------------------------------------------------------------- /pyrads/SetupGrids.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielkoll/PyRADS-shortwave/9d86f7dc07bef37f832949a584f0abe2fd3b72c4/pyrads/SetupGrids.pyc -------------------------------------------------------------------------------- /pyrads/Solar_SourceFn.py: -------------------------------------------------------------------------------- 1 | from __future__ import division, print_function, absolute_import 2 | import numpy as np 3 | from . import phys 4 | import os 5 | 6 | #### 7 | # DEFINITIONS: 8 | 9 | 10 | #Path to the datasets 11 | datapath = '/'.join( os.path.abspath(__file__).split('/')[:-2] ) + '/DATA/VPL_solar_spectrum/' # ! 12 | 13 | # 14 | solar_file = datapath + 'vpl_sunum_extended.txt' 15 | 16 | 17 | ### 18 | # Return a normalized solar spectrum by interpolating the VPL spectrum. 19 | # returns units = W/m^2/cm-1 20 | # 21 | # paper: Segura et al, 2003, Astrobiology 22 | # link: vpl.astro.washington.edu/spectra/stellar/other_stars.htm 23 | # 24 | # CAREFUL: how to deal with out of bounds interpolation? 25 | # for now, set to zero! 26 | 27 | def get_solar_fn(Lstar): 28 | 29 | # 1) read vpl file 30 | data = np.genfromtxt(solar_file,skip_header=1) 31 | wvl,sun = data[:,0],data[:,1] 32 | sun = sun*1e4 # convert W/cm2/micron to W/m^2/micron 33 | 34 | # 2) now convert everything to W/m^2/cm-1 35 | # note: B_n = B_lambda * (-1)*lambda^2 36 | n = 1./(wvl*1e-4) 37 | n = n[::-1] # flip so monotonically increasing... 38 | 39 | sun_n = sun*wvl*(wvl*1e-4) # W/m2/micron *(micron) *(cm) 40 | sun_n = sun_n[::-1] 41 | 42 | sun_n = sun_n/np.trapz(sun_n,x=n) * Lstar # normalize 43 | print( "(get_solar_fn) integrated solar source fn: %.4f W/m2" % (np.trapz(sun_n,x=n)) ) # TESTING 44 | 45 | 46 | # 3) define interpolation fn 47 | oob = 0. # out of bounds: zero or nan? 48 | get_solar = lambda nu: np.interp(nu,n,sun_n,left=oob,right=oob) 49 | 50 | return get_solar 51 | -------------------------------------------------------------------------------- /pyrads/Solar_SourceFn.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielkoll/PyRADS-shortwave/9d86f7dc07bef37f832949a584f0abe2fd3b72c4/pyrads/Solar_SourceFn.pyc -------------------------------------------------------------------------------- /pyrads/Thermodynamics.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Thermodynamic helper functions. 3 | ''' 4 | from __future__ import division, print_function, absolute_import 5 | import numpy as np 6 | 7 | 8 | # Saturation vapor pressure from the Clausius-Clapeyron relation. 9 | # --> assumes L is constant with temperature! 10 | def get_satvps(T,T0,e0,Rv,Lv): 11 | return e0*np.exp(-(Lv/Rv)*(1./T - 1./T0)) 12 | 13 | 14 | # --- 15 | # Input: T and *total* pressure. (Partial dry pressure is inferred.) 16 | # Output: saturation specific humidity 17 | def get_qsat(T,p_tot,params): 18 | eps = params.R/params.Rv 19 | p_dry = p_tot - params.esat(T) 20 | qsat = eps* params.esat(T)/( eps* params.esat(T) + p_dry ) 21 | return qsat 22 | 23 | 24 | # --- 25 | # Input: T and *total* pressure. (Partial dry pressure is inferred.) 26 | # Output: specific humidity. 27 | # 28 | # --> Valid for any value of RH! If RH=1, reduces to get_qsat. 29 | def get_q(T,p_tot,params,RH=1.): 30 | eps = params.R/params.Rv 31 | p_h2o = RH*params.esat(T) 32 | p_dry = p_tot - p_h2o 33 | q = eps*p_h2o/(p_dry + eps*p_h2o) 34 | return q 35 | 36 | 37 | # --- 38 | # Input: T and *total* pressure. 39 | # Output: mass mixing ratio r := rho_H2O / rho_dry = m_H2O*p_H2O / (m_dry * p_dry) 40 | # 41 | # NOTE: this is NOT the volume/number mixing ratio ! 42 | # for that simply use n_H2O/n_dry = p_H2O/p_dry 43 | def get_rsat(T,p_tot,params): 44 | eps = params.R/params.Rv 45 | e_sat = params.esat(T) 46 | p_dry = p_tot - e_sat 47 | r_sat = eps * e_sat / p_dry 48 | return r_sat 49 | 50 | 51 | 52 | 53 | 54 | # --- 55 | # Input: abundance of gas, by volume and/or number of molecules 56 | # molar concentration eta := n_i / (n_i + n_rest) 57 | # Output: abundance of gas, by mass 58 | # mass mixing ratio q := rho_i / (rho_i + rho_rest) 59 | # 60 | # where rho_i is (mass) density, and n_i is number density. 61 | # 62 | # Formula is (see, e.g., PoPC p.86-87): 63 | # q_i = eta_i * /R_i, where is the mass-weighted average gas constant 64 | # = q_a*R_a + q_b*R_b + ... 65 | # If I'm only given molar concentrations, use instead 66 | # = 1./( eta_a/R_a + eta_b/R_b + ...) 67 | # 68 | # USES, e.g.: 69 | # - convert 300 ppmv of CO2 into a mass mixing ratio. 70 | 71 | def convert_molar_to_mass_ratio(molar_i,R_i,R_air): 72 | molar_air = 1. - molar_i 73 | R_mean = 1./(molar_i/R_i + molar_air/R_air) 74 | q_i = molar_i * R_mean/R_i 75 | return q_i 76 | -------------------------------------------------------------------------------- /pyrads/Thermodynamics.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielkoll/PyRADS-shortwave/9d86f7dc07bef37f832949a584f0abe2fd3b72c4/pyrads/Thermodynamics.pyc -------------------------------------------------------------------------------- /pyrads/VerticalStructure.py: -------------------------------------------------------------------------------- 1 | ''' 2 | *********************************************************** 3 | This script provides a number of functions to compute 4 | vertical temperature,humidity structure. 5 | *********************************************************** 6 | ''' 7 | from __future__ import division, print_function, absolute_import 8 | 9 | import numpy as np 10 | import scipy 11 | from scipy.optimize import fsolve # [!] 12 | from .Thermodynamics import get_qsat,get_q,get_satvps 13 | 14 | 15 | # Returns T-p, q-p profiles, assuming a moist adiabat. 16 | # Allow for a isothermal stratosphere with q equal to 17 | # its value at the tropopause. 18 | # 19 | # HERE: T from moist adiabat, q scales with qsat & RH. 20 | # (~T is set by a convecting region, but mean q is lower due to additional processes) 21 | # 22 | # NOTE: q = RH*qsat is only valid if water vapor is dilute! 23 | # 24 | # USAGE: 25 | # T_vector,q_vector = get_Tq_moist( p_vector,Ts,ps,Tstrat=200. ) 26 | 27 | def get_Tq_moist(p,Ts,ps,params,RH=1.,Tstrat=None): 28 | 29 | # careful: I might need to flip p-array for my solver to work 30 | # --> need p to increase monotonically! 31 | T_adiabat = get_TofP_MoistAdiabat(p[::-1],Ts,ps,params)[::-1] 32 | 33 | q_adiabat = get_q(T_adiabat,p,params,RH=RH) 34 | 35 | if Tstrat is not None and np.any(T_adiabat < Tstrat): 36 | # caution: only implements stratosphere if T for now I'm assuming it's the total pressure! 61 | 62 | def get_TofP_MoistAdiabat(p,Ts,ps_in,params): 63 | esat = lambda T: get_satvps(T,params.satvap_T0,params.satvap_e0,params.Rv,params.Lvap) 64 | rsat = lambda T,pa: params.R/params.Rv * esat(T)/pa 65 | 66 | #ps = ps_in + esat(Ts) # here: assume ps_in is dry pressure only 67 | ps = ps_in 68 | 69 | # (integrate dlogT/dlog(p/ps)): based on eqn. 12 in Ding & Pierrehumbert (2016) 70 | def slope(logT,logpps): 71 | T = np.exp(logT) 72 | p = np.exp(logpps) * ps 73 | 74 | pc = esat(T) 75 | pa = p - pc 76 | 77 | alpha = params.Lvap/(params.R*T) 78 | beta = params.Lvap/(params.Rv*T) 79 | gamma = params.Lvap/(params.cp*T) 80 | 81 | return 1./( pc/p*beta + \ 82 | pa/p*params.cp/params.R * \ 83 | (1.+ (params.cpv/params.cp + (beta-1.)*gamma)*rsat(T,pa)) / (1.+alpha*rsat(T,pa)) ) 84 | 85 | # First element of log(p/ps) vector needs to be the initial condition. 86 | # log(Ts)<->log(p/ps=1)=0. 87 | # Rest contains p levels that we want to know T for. 88 | if hasattr(p,"__len__"): 89 | pps_vector = np.append([1.],p/ps) 90 | else: 91 | pps_vector = [1.,p/ps] 92 | 93 | logInt = scipy.integrate.odeint( slope,np.log(Ts),np.log(pps_vector) ) 94 | logInt = np.squeeze( logInt ) 95 | 96 | if hasattr(p,"__len__"): 97 | return np.exp(logInt[1:]) # don't return initial value... 98 | else: 99 | return np.exp(logInt[-1]) # don't return initial value... 100 | 101 | 102 | # analytical dry adiabat, T=T(p) 103 | def get_TofP_DryAdiabat(p,Ts,ps,params): 104 | return Ts*( p/ps )**(params.R/params.cp) 105 | 106 | # analytical single-component moist adiabat, T=T(p) 107 | def get_TofP_SingleCompAdiabat(p,params): 108 | return params.satvap_T0 / (1. - params.Rv*params.satvap_T0/params.Lvap * np.log(p/params.satvap_e0) ) 109 | -------------------------------------------------------------------------------- /pyrads/VerticalStructure.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielkoll/PyRADS-shortwave/9d86f7dc07bef37f832949a584f0abe2fd3b72c4/pyrads/VerticalStructure.pyc -------------------------------------------------------------------------------- /pyrads/Write_Data.py: -------------------------------------------------------------------------------- 1 | from __future__ import division, print_function, absolute_import 2 | import numpy as np 3 | from . import phys 4 | 5 | ### ----------------------------------- 6 | ### Helpers 7 | class Dummy: 8 | pass 9 | 10 | 11 | ### ----------------------------------- 12 | # save (T,p,q) structure and corresponding SW fluxes. 13 | # wave0,wave1,dwave - floats 14 | # p,T,q - 1d arrays 15 | # zenith_list - list 16 | # SW flux lists - lists of 1d arrays: 17 | # [ shape(pressure),shape(pressure),...] -> overall len(zenith_list) long 18 | 19 | def save_profile( OUTDIR,wave0,wave1,dwave,p,T,q, \ 20 | zenith_list,SWdirect_list,SWminus_list,SWplus_list ): 21 | 22 | filename = "output" + "_nA%.1f" % wave0 + "_nB%.1f" % wave1 + "_dn%.2e" % dwave + ".txt" 23 | 24 | ## create new/blank file: 25 | f = open(OUTDIR+filename,'w') 26 | f.close() 27 | 28 | ## save data: 29 | f = open(OUTDIR+filename,'a') 30 | for zenith,SWdirect,SWminus,SWplus in zip(zenith_list,SWdirect_list,SWminus_list,SWplus_list): 31 | f.write("wavenr_min,wavenr_max,dwave [cm^-1] = %.4f,%.4f,%.4f" % (wave0,wave1,dwave) ) 32 | f.write("\n") 33 | f.write("zenith angle = %.4f" % (zenith) ) 34 | f.write("\n") 35 | f.write("pressure [bar],\tTemperature [K],\tSpecific Humidity[-],\tdir SW flux [W/m2],\tdn SW flux [W/m2],\tup SW flux [W/m2]") 36 | f.write("\n") 37 | for p_i,T_i,q_i,SWdirect_i,SWminus_i,SWplus_i in zip(p,T,q,SWdirect,SWminus,SWplus): 38 | f.write("%.6e,\t%.6e,\t%.6e,\t%.6e,\t%.6e,\t%.6e" % (p_i/1e5,T_i,q_i,SWdirect_i,SWminus_i,SWplus_i) ) 39 | f.write("\n") 40 | f.write("\n") 41 | f.write("\n") 42 | 43 | f.close() 44 | 45 | -------------------------------------------------------------------------------- /pyrads/Write_Data.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielkoll/PyRADS-shortwave/9d86f7dc07bef37f832949a584f0abe2fd3b72c4/pyrads/Write_Data.pyc -------------------------------------------------------------------------------- /pyrads/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | 3 | from . import Absorption_Continuum 4 | from . import Absorption_Continuum_MTCKD 5 | from . import Absorption_Crosssections_HITRAN2016 6 | from . import Absorption_Crosssections_UV 7 | from . import hitran_cia_fast 8 | from . import ClimateUtilities 9 | from . import Get_Fluxes 10 | from . import Get_Fluxes_pyDISORT 11 | from . import OpticalThickness 12 | from . import Planck 13 | from . import SetupGrids 14 | from . import Thermodynamics 15 | from . import VerticalStructure 16 | from . import object_helpers 17 | from . import phys 18 | from . import Write_Data 19 | from . import Merge_Spectral_Output 20 | from . import Solar_SourceFn 21 | from . import Scattering_Crosssections_Rayleigh 22 | 23 | -------------------------------------------------------------------------------- /pyrads/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielkoll/PyRADS-shortwave/9d86f7dc07bef37f832949a584f0abe2fd3b72c4/pyrads/__init__.pyc -------------------------------------------------------------------------------- /pyrads/hitran_cia_fast.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielkoll/PyRADS-shortwave/9d86f7dc07bef37f832949a584f0abe2fd3b72c4/pyrads/hitran_cia_fast.pyc -------------------------------------------------------------------------------- /pyrads/object_helpers.py: -------------------------------------------------------------------------------- 1 | from __future__ import division, print_function, absolute_import 2 | from copy import copy # to copy lists of objects... 3 | 4 | # ================================================================================== 5 | # Retrieve object(s) from obj list that match obj.attribute == value 6 | # or function(obj.attribute,value). 7 | # Either return object or list. 8 | # Usages: 9 | # sublist = get_objects_from_list(masterlist,"name","Dry_50") 10 | # sublist = get_objects_from_list(masterlist,"omega",5,comparefn=largerthan) 11 | # (note: comparefn(x,y) must return a boolean!) 12 | 13 | def get_objects_from_list(obj_list,attribute,value,comparefn=None): 14 | if comparefn is None: 15 | x = [obj for obj in obj_list if getattr(obj,attribute)==value] 16 | else: 17 | x = [obj for obj in obj_list if comparefn(getattr(obj,attribute),value)] 18 | 19 | if len(x)==1: 20 | x = x[0] 21 | return x 22 | -------------------------------------------------------------------------------- /pyrads/object_helpers.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielkoll/PyRADS-shortwave/9d86f7dc07bef37f832949a584f0abe2fd3b72c4/pyrads/object_helpers.pyc -------------------------------------------------------------------------------- /pyrads/phys.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielkoll/PyRADS-shortwave/9d86f7dc07bef37f832949a584f0abe2fd3b72c4/pyrads/phys.pyc --------------------------------------------------------------------------------