# cb = GreyCodeBase.from_repo(repo='[email protected]:sit23/Isca.git', commit='7145be9') # or it can point to a specific git repo and commit id. # This method should ensure future, independent, reproducibility of results. # cb = DryCodeBase.from_repo(repo='https://github.com/isca/isca', commit='isca1.1') # compilation depends on computer specific settings. The $GFDL_ENV # environment variable is used to determine which `$GFDL_BASE/src/extra/env` file # is used to load the correct compilers. The env file is always loaded from # $GFDL_BASE and not the checked out git repo. cb.compile( ) # compile the source code to working directory $GFDL_WORK/codebase # create a diagnostics output file for daily snapshots diag = DiagTable() #for atmos_monthly: 30 'days' in a 'month' multiplied by length of day in seconds diag.add_file('atmos_monthly', 30 * 1379678, 'seconds', time_units='days') #for atmos_daily: length of 'day' in seconds #diag.add_file('atmos_daily', 1379678 , 'seconds', time_units='days') #diag.add_file('atmos_e_daily',1 , 'days', time_units='days') #diag.add_file('atmos_timestep', 240, 'seconds', time_units='days') # Define diag table entries diag.add_field('dynamics', 'ps', time_avg=True) diag.add_field('dynamics', 'bk', time_avg=True) diag.add_field('dynamics', 'pk', time_avg=True) diag.add_field('dynamics', 'ucomp', time_avg=True) diag.add_field('dynamics', 'vcomp', time_avg=True) diag.add_field('dynamics', 'temp', time_avg=True)
# note on this experiement. # The original era land file will generate Gibbs ripples if land is used. # This files only purpose if for testing the behaviour of era land. # exp = Experiment('soc_aquaplanet_amip_old_era_land', codebase=cb) exp.clear_rundir() inputfiles = [os.path.join(GFDL_BASE,'input/rrtm_input_files/ozone_1990.nc'), os.path.join(GFDL_BASE,'input/land_masks/era_land_t42.nc'), os.path.join(GFDL_BASE,'exp/test_cases/realistic_continents/input/sst_clim_amip.nc'), os.path.join(GFDL_BASE,'exp/test_cases/realistic_continents/input/siconc_clim_amip.nc'), ] #Tell model how to write diagnostics diag = DiagTable() diag.add_file('atmos_monthly', 30, 'days', time_units='days') #Write out diagnostics need for vertical interpolation post-processing diag.add_field('dynamics', 'ps', time_avg=True) diag.add_field('dynamics', 'bk') diag.add_field('dynamics', 'pk') diag.add_field('dynamics', 'zsurf') #Tell model which diagnostics to write diag.add_field('atmosphere', 'precipitation', time_avg=True) diag.add_field('atmosphere', 'rh', time_avg=True) diag.add_field('mixed_layer', 't_surf', time_avg=True) diag.add_field('mixed_layer', 'flux_t', time_avg=True) #SH diag.add_field('mixed_layer', 'flux_lhe', time_avg=True) #LH diag.add_field('dynamics', 'sphum', time_avg=True)
# copy/link qflux file to builddir #qflux_file_name = 'merlis_schneider_30_16' qflux_file_name = 'off' if qflux_file_name != 'off': if not os.path.exists(builddir + '/' + qflux_file_name + '.nc'): shutil.copy( os.environ['GFDL_BASE'] + '/ictp-isca-workshop-2018/experiments/earth_projects/project_5_qfluxes/' + qflux_file_name + '.nc', builddir + '/' + qflux_file_name + '.nc') #Step 4. Define the diagnostics we want to be output from the model print('Step 4: setting output variables') avgflag = True diag = DiagTable() diag.add_file('atmos_monthly', 30, 'days', time_units='days') diag.add_file('atmos_daily', 1, 'days', time_units='days') if 'debug' in todo: debug = True run_ddt = True avgflag = False diag.add_file('atmos_hourly', 1, 'hours', time_units='hours') #NCORES=1 #Tell model which diagnostics to write to those files diag.add_field('dynamics', 'ps', time_avg=avgflag) diag.add_field('dynamics', 'bk') diag.add_field('dynamics', 'pk') diag.add_field('dynamics', 'zsurf') diag.add_field('dynamics', 'sphum', time_avg=avgflag)
) # compile the source code to working directory $GFDL_WORK/codebase # create an Experiment object to handle the configuration of model parameters # and output diagnostics #### NORTHLAND : change name of experiment when you're running a different set-up e.g. northland_different_albedo ##### exp = Experiment('northland_different_albedo', codebase=cb) #Add any input files that are necessary for a particular experiment. ##### NORTHLAND: I've uploaded the half_ocean landmask file (land.nc) to input/half_ocean/, make sure to copy it into your Isca/input folder) exp.inputfiles = [ os.path.join(GFDL_BASE, 'input/half_ocean/land.nc'), os.path.join(GFDL_BASE, 'input/rrtm_input_files/ozone_1990.nc') ] #Tell model how to write diagnostics diag = DiagTable() diag.add_file('atmos_monthly', 30, 'days', time_units='days') #Tell model which diagnostics to write diag.add_field('dynamics', 'ps', time_avg=True) diag.add_field('dynamics', 'bk') diag.add_field('dynamics', 'pk') diag.add_field('atmosphere', 'precipitation', time_avg=True) diag.add_field('mixed_layer', 't_surf', time_avg=True) # surface temperature diag.add_field('dynamics', 'sphum', time_avg=True) # specific humidity diag.add_field('dynamics', 'ucomp', time_avg=True) # zonal velocity component diag.add_field('dynamics', 'vcomp', time_avg=True) # meridional velocity component diag.add_field('dynamics', 'temp', time_avg=True) # 4D temperature diag.add_field('dynamics', 'vor', time_avg=True) # vorticity diag.add_field('dynamics', 'div', time_avg=True) # divergence
# cb = DryCodeBase.from_repo(repo='https://github.com/isca/isca', commit='isca1.1') # compilation depends on computer specific settings. The $GFDL_ENV # environment variable is used to determine which `$GFDL_BASE/src/extra/env` file # is used to load the correct compilers. The env file is always loaded from # $GFDL_BASE and not the checked out git repo. cb.compile( ) # compile the source code to working directory $GFDL_WORK/codebase # create an Experiment object to handle the configuration of model parameters # and output diagnostics exp = Experiment('frierson_rotate_slow', codebase=cb) #Tell model how to write diagnostics diag = DiagTable() diag.add_file('atmos_monthly', 30, 'days', time_units='days') #Tell model which diagnostics to write diag.add_field('dynamics', 'ps', time_avg=True) diag.add_field('dynamics', 'bk') diag.add_field('dynamics', 'pk') diag.add_field('atmosphere', 'precipitation', time_avg=True) diag.add_field('mixed_layer', 't_surf', time_avg=True) diag.add_field('dynamics', 'sphum', time_avg=True) diag.add_field('dynamics', 'ucomp', time_avg=True) diag.add_field('dynamics', 'vcomp', time_avg=True) diag.add_field('dynamics', 'temp', time_avg=True) diag.add_field('dynamics', 'vor', time_avg=True) diag.add_field('dynamics', 'div', time_avg=True)
import numpy as np from isca import IscaCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE base_dir = os.path.dirname(os.path.realpath(__file__)) #Step 1: Point the python script to the location of the code (the bash environment variable GFDL_BASE is that directory) cb = IscaCodeBase.from_directory(GFDL_BASE) #Step 2. Provide the necessary inputs for the model to run: #Input files (none required for simple Held Suarez, so the list is empty) inputfiles=[] #Define the diagnostics we want to be output from the model diag = DiagTable() #We might want monthly output, so the file name will be 'atmos_monthly', and the timescale for the averaging window is 30 days. diag.add_file('atmos_monthly', 30, 'days', time_units='days') #We might also want daily output, so add that too: diag.add_file('atmos_daily', 1, 'days', time_units='days') #Tell model which diagnostics to write to those files #The format is: #diag.add_field(MODULE_NAME, VARIABLE_NAME, time_avg=True or False, files=LIST_OF_WHICH_FILES TO INCLUDE THIS VARIABLE IN (default is all files) diag.add_field('dynamics', 'ps', time_avg=True) diag.add_field('dynamics', 'bk') diag.add_field('dynamics', 'pk') diag.add_field('dynamics', 'zsurf') diag.add_field('dynamics', 'sphum', time_avg=True) diag.add_field('dynamics', 'ucomp', time_avg=True)
for sss in glob.glob(os.environ["GFDL_WORK"] + "/codebase/" + objdir + "/build/isca/" + ss + "*"): os.remove(sss) #Step 2. Provide the necessary inputs for the model to run: inputfiles = [os.path.join(GFDL_BASE, 'input/rrtm_input_files/ozone_1990.nc')] # copy/link qflux file to builddir qflux_file_name = 'merlis_schneider_30_16' if not os.path.exists(builddir + '/' + qflux_file_name + '.nc'): shutil.copy( os.environ['GFDL_BASE'] + '/ictp-isca-workshop-2018/experiments/earth_projects/project_5_qfluxes/' + qflux_file_name + '.nc', builddir + '/' + qflux_file_name + '.nc') #Step 3. Define the diagnostics we want to be output from the model diag = DiagTable() diag.add_file('atmos_monthly', 30, 'days', time_units='days') diag.add_file('atmos_daily', 1, 'days', time_units='days') #Tell model which diagnostics to write to those files diag.add_field('dynamics', 'ps', time_avg=True) diag.add_field('dynamics', 'bk') diag.add_field('dynamics', 'pk') diag.add_field('dynamics', 'zsurf') diag.add_field('atmosphere', 'precipitation', time_avg=True) diag.add_field('mixed_layer', 't_surf', time_avg=True) diag.add_field('dynamics', 'sphum', time_avg=True) diag.add_field('dynamics', 'ucomp', time_avg=True) diag.add_field('dynamics', 'vcomp', time_avg=True) diag.add_field('dynamics', 'temp', time_avg=True) diag.add_field('dynamics', 'vor', time_avg=True) diag.add_field('dynamics', 'div', time_avg=True)
cb.compile( ) # compile the source code to working directory $GFDL_WORK/codebase # create an Experiment object to handle the configuration of model parameters # and output diagnostics exp = Experiment('full_continents_land_evap_pref07_fixedSSTs', codebase=cb) #Add any input files that are necessary for a particular experiment. exp.inputfiles = [ os.path.join(GFDL_BASE, 'input/all_continents/land.nc'), os.path.join(GFDL_BASE, 'input/rrtm_input_files/ozone_1990.nc'), os.path.join(GFDL_BASE, 'input/sst_clim_amip.nc') ] #Tell model how to write diagnostics diag = DiagTable() diag.add_file('atmos_monthly', 30, 'days', time_units='days') #Tell model which diagnostics to write diag.add_field('dynamics', 'ps', time_avg=True) diag.add_field('dynamics', 'bk') diag.add_field('dynamics', 'pk') diag.add_field('atmosphere', 'precipitation', time_avg=True) diag.add_field('mixed_layer', 't_surf', time_avg=True) diag.add_field('dynamics', 'sphum', time_avg=True) diag.add_field('dynamics', 'ucomp', time_avg=True) diag.add_field('dynamics', 'vcomp', time_avg=True) diag.add_field('dynamics', 'temp', time_avg=True) diag.add_field('dynamics', 'vor', time_avg=True) diag.add_field('dynamics', 'div', time_avg=True) diag.add_field('dynamics', 'omega', time_avg=True)
def setup_grey_mars_diag(): # create a diagnostics output file for daily snapshots diag = DiagTable() diag.add_file('atmos_daily', 88440, 'seconds', time_units='days') # Define diag tablentries diag.add_field('dynamics', 'ps', time_avg=True) diag.add_field('dynamics', 'bk', time_avg=True) diag.add_field('dynamics', 'pk', time_avg=True) diag.add_field('dynamics', 'ucomp', time_avg=True) diag.add_field('dynamics', 'vcomp', time_avg=True) diag.add_field('dynamics', 'temp', time_avg=True) diag.add_field('dynamics', 'omega', time_avg=True) diag.add_field('dynamics', 'height', time_avg=True) diag.add_field('dynamics', 'sphum', time_avg=True) diag.add_field('atmosphere', 'precipitation', time_avg=True) diag.add_field('atmosphere', 'dt_tg_convection', time_avg=True) diag.add_field('mixed_layer', 't_surf', time_avg=True) diag.add_field('mixed_layer', 'flux_lhe', time_avg=True) diag.add_field('mixed_layer', 'flux_t', time_avg=True) diag.add_field('two_stream', 'mars_solar_long', time_avg=True) diag.add_field('two_stream', 'coszen', time_avg=True) diag.add_field('two_stream', 'rrsun', time_avg=True) diag.add_field('two_stream', 'swdn_toa', time_avg=True) diag.add_field('two_stream', 'time_since_ae', time_avg=True) diag.add_field('two_stream', 'true_anomaly', time_avg=True) diag.add_field('two_stream', 'dec', time_avg=True) diag.add_field('two_stream', 'ang', time_avg=True) return diag
# compilation depends on computer specific settings. The $GFDL_ENV # environment variable is used to determine which `$GFDL_BASE/src/extra/env` file # is used to load the correct compilers. The env file is always loaded from # $GFDL_BASE and not the checked out git repo. # create an Experiment object to handle the configuration of model parameters # and output diagnostics exp = Experiment('soc_test_aquaplanet', codebase=cb) exp.clear_rundir() inputfiles = [os.path.join(GFDL_BASE, 'input/rrtm_input_files/ozone_1990.nc')] #Tell model how to write diagnostics diag = DiagTable() diag.add_file('atmos_monthly', 30, 'days', time_units='days') #Tell model which diagnostics to write diag.add_field('dynamics', 'ps', time_avg=True) diag.add_field('dynamics', 'bk') diag.add_field('dynamics', 'pk') diag.add_field('atmosphere', 'precipitation', time_avg=True) diag.add_field('mixed_layer', 't_surf', time_avg=True) diag.add_field('dynamics', 'sphum', time_avg=True) diag.add_field('dynamics', 'ucomp', time_avg=True) diag.add_field('dynamics', 'vcomp', time_avg=True) diag.add_field('dynamics', 'temp', time_avg=True) diag.add_field('dynamics', 'vor', time_avg=True) diag.add_field('dynamics', 'div', time_avg=True)
cb = DryCodeBase.from_directory(GFDL_BASE) # or it can point to a specific git repo and commit id. # This method should ensure future, independent, reproducibility of results. # cb = DryCodeBase.from_repo(repo='https://github.com/isca/isca', commit='isca1.1') # compilation depends on computer specific settings. The $GFDL_ENV # environment variable is used to determine which `$GFDL_BASE/src/extra/env` file # is used to load the correct compilers. The env file is always loaded from # $GFDL_BASE and not the checked out git repo. cb.compile( ) # compile the source code to working directory $GFDL_WORK/codebase # create a diagnostics output file for daily snapshots diag = DiagTable() diag.add_file('atmos_daily', 1, 'days', time_units='days') # Define diag table entries diag.add_field('dynamics', 'ps', time_avg=True, files=['atmos_daily']) diag.add_field('dynamics', 'bk', time_avg=True, files=['atmos_daily']) diag.add_field('dynamics', 'pk', time_avg=True, files=['atmos_daily']) diag.add_field('dynamics', 'vor', time_avg=True, files=['atmos_daily']) diag.add_field('dynamics', 'div', time_avg=True, files=['atmos_daily']) diag.add_field('dynamics', 'ucomp', time_avg=True, files=['atmos_daily']) diag.add_field('dynamics', 'vcomp', time_avg=True, files=['atmos_daily']) diag.add_field('dynamics', 'temp', time_avg=True, files=['atmos_daily']) diag.add_field('dynamics', 'slp', time_avg=True, files=['atmos_daily']) diag.add_field('dynamics', 'omega', time_avg=True, files=['atmos_daily']) diag.add_field('dynamics', 'height', time_avg=True, files=['atmos_daily']) diag.add_field('dynamics', 'height_half', time_avg=True, files=['atmos_daily'])
# is used to load the correct compilers. The env file is always loaded from # $GFDL_BASE and not the checked out git repo. cb.compile( ) # compile the source code to working directory $GFDL_WORK/codebase inputfiles = [ os.path.join(base_dir, 'input/sp_lw_17_dsa_mars'), os.path.join(base_dir, 'input/sp_sw_42_dsa_mars_sun'), os.path.join(base_dir, 'input/sp_lw_17_dsa_mars_k'), os.path.join(base_dir, 'input/sp_sw_42_dsa_mars_sun_k'), os.path.join(base_dir, 'input/t42_mola_mars.nc') ] # create a diagnostics output file for daily snapshots diag = DiagTable() #diag.add_file('atmos_monthly', 30, 'days', time_units='days') diag.add_file('atmos_daily', 88440, 'seconds', time_units='days') #diag.add_file('atmos_e_daily',1 , 'days', time_units='days') #diag.add_file('atmos_timestep', 240, 'seconds', time_units='days') # Define diag table entries diag.add_field('dynamics', 'ps', time_avg=True) diag.add_field('dynamics', 'bk', time_avg=True) diag.add_field('dynamics', 'pk', time_avg=True) diag.add_field('dynamics', 'zsurf', time_avg=True) diag.add_field('dynamics', 'ucomp', time_avg=True) diag.add_field('dynamics', 'vcomp', time_avg=True) diag.add_field('dynamics', 'temp', time_avg=True)
def setup_held_suarez_diag(): diag = DiagTable() diag.add_file('atmos_monthly', 30, 'days', time_units='days') # Tell model which diagnostics to write diag.add_field('dynamics', 'ps', time_avg=True) diag.add_field('dynamics', 'bk') diag.add_field('dynamics', 'pk') diag.add_field('dynamics', 'ucomp', time_avg=True) diag.add_field('dynamics', 'vcomp', time_avg=True) diag.add_field('dynamics', 'temp', time_avg=True) diag.add_field('dynamics', 'vor', time_avg=True) diag.add_field('dynamics', 'div', time_avg=True) return diag
# is used to load the correct compilers. The env file is always loaded from # $GFDL_BASE and not the checked out git repo. #cb.compile() # compile the source code to working directory $GFDL_WORK/codebase # create an Experiment object to handle the configuration of model parameters # and output diagnostics exp = Experiment(exp_name, codebase=cb) #RF - by default this points the field_table to srcdir/extra/model # this line sets the field table to be in the input_dir #field_table_file='field_table_fv' #exp.field_table_file=os.getcwd()+'/input/'+field_table_file #Tell model how to write diagnostics diag = DiagTable() diag.add_file('4xday', 6, 'hours', time_units='days') #Tell model which diagnostics to write diag.add_field('dynamics', 'ps', time_avg=True) diag.add_field('dynamics', 'bk') diag.add_field('dynamics', 'pk') diag.add_field('dynamics', 'sphum', time_avg=True) diag.add_field('dynamics', 'vcomp', time_avg=True) diag.add_field('dynamics', 'ucomp', time_avg=True) diag.add_field('atmosphere', 'theta', time_avg=True) diag.add_field('dynamics', 'omega', time_avg=True) diag.add_field('atmosphere', 'dt_qg_condensation', time_avg=True) diag.add_field('atmosphere', 'dt_qg_convection', time_avg=True) diag.add_field('atmosphere', 'dt_tg_condensation', time_avg=True) diag.add_field('atmosphere', 'dt_tg_convection', time_avg=True)
# framework and IO config 'diag_manager_nml': { # diagmanager gives a warning if you don't set this 'mix_snapshot_average_fields': False }, 'fms_nml': { 'domains_stack_size': 600000 # default: 0 }, 'fms_io_nml': { 'threading_write': 'single', # default: multi 'fileset_write': 'single', # default: multi }, }) diag_table = DiagTable() #diag_table.add_file('6hourly', 6*60*60, 'seconds', time_units='days') #diag_table.add_file('hourly', 1, 'hours', time_units='days') diag_table.add_file('daily', 1, 'days', time_units='days') diag_table.add_field('dynamics', 'ps') diag_table.add_field('dynamics', 'bk') diag_table.add_field('dynamics', 'pk') diag_table.add_field('dynamics', 'ucomp') diag_table.add_field('dynamics', 'vcomp') diag_table.add_field('dynamics', 'omega') diag_table.add_field('dynamics', 'temp') diag_table.add_field('dynamics', 'vor') diag_table.add_field('dynamics', 'div') diag_table.add_field('dynamics', 'height')
# or it can point to a specific git repo and commit id. # This method should ensure future, independent, reproducibility of results. # cb = DryCodeBase.from_repo(repo='https://github.com/isca/isca', commit='isca1.1') # compilation depends on computer specific settings. The $GFDL_ENV # environment variable is used to determine which `$GFDL_BASE/src/extra/env` file # is used to load the correct compilers. The env file is always loaded from # $GFDL_BASE and not the checked out git repo. # create an Experiment object to handle the configuration of model parameters # and output diagnostics inputfiles=[] #Tell model how to write diagnostics diag = DiagTable() diag.add_file('atmos_monthly', 30, 'days', time_units='days') #Tell model which diagnostics to write diag.add_field('dynamics', 'ps', time_avg=True) diag.add_field('dynamics', 'bk') diag.add_field('dynamics', 'pk') diag.add_field('dynamics', 'zsurf') diag.add_field('dynamics', 'sphum', time_avg=True) diag.add_field('dynamics', 'ucomp', time_avg=True) diag.add_field('dynamics', 'vcomp', time_avg=True) diag.add_field('dynamics', 'temp', time_avg=True) diag.add_field('dynamics', 'vor', time_avg=True) diag.add_field('dynamics', 'div', time_avg=True) diag.add_field('dynamics', 'height', time_avg=True)
) # compile the source code to working directory $GFDL_WORK/codebase # create an Experiment object to handle the configuration of model parameters # and output diagnostics exp = Experiment('realistic_continents_qflux_test_experiment', codebase=cb) #Add any input files that are necessary for a particular experiment. exp.inputfiles = [ os.path.join(GFDL_BASE, 'input/land_masks/era_land_t42.nc'), os.path.join(GFDL_BASE, 'input/rrtm_input_files/ozone_1990.nc'), os.path.join(base_dir, 'input/ami_qflux_ctrl_ice_4320.nc'), os.path.join(base_dir, 'input/siconc_clim_amip.nc') ] #Tell model how to write diagnostics diag = DiagTable() diag.add_file('atmos_monthly', 30, 'days', time_units='days') #Tell model which diagnostics to write diag.add_field('dynamics', 'ps', time_avg=True) diag.add_field('dynamics', 'bk') diag.add_field('dynamics', 'pk') diag.add_field( 'dynamics', 'zsurf' ) #need at least ps, pk, bk and zsurf to do vertical interpolation onto plevels from sigma diag.add_field('atmosphere', 'precipitation', time_avg=True) diag.add_field('mixed_layer', 't_surf', time_avg=True) diag.add_field('dynamics', 'sphum', time_avg=True) diag.add_field('dynamics', 'ucomp', time_avg=True) diag.add_field('dynamics', 'vcomp', time_avg=True) diag.add_field('dynamics', 'temp', time_avg=True)
# is used to load the correct compilers. The env file is always loaded from # $GFDL_BASE and not the checked out git repo. #cb.compile() # compile the source code to working directory $GFDL_WORK/codebase # create an Experiment object to handle the configuration of model parameters # and output diagnostics exp = Experiment(exp_name, codebase=cb) #RF - by default this points the field_table to srcdir/extra/model # this line sets the field table to be in the input_dir #field_table_file='field_table_fv' #exp.field_table_file=os.getcwd()+'/input/'+field_table_file #Tell model how to write diagnostics diag = DiagTable() diag.add_file('4xday', 6, 'hours', time_units='days') #Tell model which diagnostics to write diag.add_field('dynamics', 'ps', time_avg=True) diag.add_field('dynamics', 'bk') diag.add_field('dynamics', 'pk') diag.add_field('dynamics', 'sphum', time_avg=True) diag.add_field('dynamics', 'ucomp', time_avg=True) diag.add_field('dynamics', 'vcomp', time_avg=True) diag.add_field('dynamics', 'omega', time_avg=True) diag.add_field('dynamics', 'temp', time_avg=True) diag.add_field('mixed_layer','t_surf', time_avg=True) diag.add_field('mixed_layer','flux_t',time_avg=True) diag.add_field('mixed_layer','flux_lhe',time_avg=True) diag.add_field('atmosphere','precipitation', time_avg=True)
# environment variable is used to determine which `$GFDL_BASE/src/extra/env` file # is used to load the correct compilers. The env file is always loaded from # $GFDL_BASE and not the checked out git repo. cb.compile() # compile the source code to working directory $GFDL_WORK/codebase # create an Experiment object to handle the configuration of model parameters # and output diagnostics exp = Experiment('aquaplanet_finalIscaAPqflux_zerointegral', codebase=cb) #Add any input files that are necessary for a particular experiment. exp.inputfiles = [os.path.join(GFDL_BASE,'input/aquaplanet/land.nc'),os.path.join(GFDL_BASE,'input/rrtm_input_files/ozone_1990.nc'),os.path.join(GFDL_BASE,'input/aquaplanet/isca_qflux/zero_integral/ocean_qflux.nc')] #Tell model how to write diagnostics diag = DiagTable() diag.add_file('atmos_monthly', 30, 'days', time_units='days') # to output data in two different time resolutions # diag.add_file('atmos_6_hourly', 6, 'hours', time_units='hours') #Tell model which diagnostics to write diag.add_field('dynamics', 'ps', time_avg=True) # don't specify files, then it writes to both diag.add_field('dynamics', 'bk') diag.add_field('dynamics', 'pk') diag.add_field('atmosphere', 'precipitation', time_avg=True) diag.add_field('mixed_layer', 't_surf', time_avg=True) diag.add_field('dynamics', 'sphum', time_avg=True) diag.add_field('dynamics', 'ucomp', time_avg=True) diag.add_field('dynamics', 'vcomp', time_avg=True) diag.add_field('dynamics', 'temp', time_avg=True) diag.add_field('dynamics', 'vor', time_avg=True) diag.add_field('dynamics', 'div', time_avg=True)
def define_simple_diag_table(): """Defines a simple diag table for the test cases.""" diag = DiagTable() diag.add_file('atmos_daily', 1, 'days', time_units='days') #Tell model which diagnostics to write diag.add_field('dynamics', 'ps', time_avg=True) diag.add_field('dynamics', 'bk') diag.add_field('dynamics', 'pk') diag.add_field('dynamics', 'ucomp', time_avg=True) diag.add_field('dynamics', 'vcomp', time_avg=True) diag.add_field('dynamics', 'temp', time_avg=True) diag.add_field('dynamics', 'vor', time_avg=True) diag.add_field('dynamics', 'div', time_avg=True) return diag
import os import f90nml from isca import Namelist, DiagTable, GFDL_BASE _filepath = os.path.dirname(os.path.realpath(__file__)) # A simple output diagnostic table. diag_table = DiagTable() diag_table.add_file('atmos_daily', 1, 'days', time_units='days') diag_table.add_field('dynamics', 'ps', time_avg=True) diag_table.add_field('dynamics', 'bk') diag_table.add_field('dynamics', 'pk') diag_table.add_field('dynamics', 'sphum', time_avg=True) diag_table.add_field('dynamics', 'ucomp', time_avg=True) diag_table.add_field('dynamics', 'vcomp', time_avg=True) diag_table.add_field('dynamics', 'temp', time_avg=True) diag_table.add_field('dynamics', 'vor', time_avg=True) diag_table.add_field('dynamics', 'div', time_avg=True) diag_table.add_field('atmosphere', 'precipitation', time_avg=True) diag_table.add_field('mixed_layer', 't_surf', time_avg=True) diag_table.add_field('rrtm_radiation', 'coszen', time_avg=True) diag_table.add_field('rrtm_radiation', 'olr', time_avg=True) # Load the namelist file into a namelist object # this can then be easily modified in your experiment script namelist = f90nml.read(os.path.join(_filepath, 'basic_isca.nml')) inputfiles = [os.path.join(GFDL_BASE, 'input/rrtm_input_files/ozone_1990.nc')]