Skip to content
Snippets Groups Projects
Select Git revision
  • b10ce43cf977196aa14b7c23b4c3aa244009f993
  • master default
  • clavrx2grid_only
  • viirs_interp
4 results

iris.py

Blame
  • Forked from Michael Hiley / ssec
    46 commits behind the upstream repository.
    iris.py 1.23 KiB
    import subprocess
    
    # note, need to double the curly braces on bash vars in order to use .format:
    template = """#!/bin/bash
    #SBATCH --job-name={job_name}
    #SBATCH --partition=all
    #SBATCH --share
    #SBATCH --time=0:10:00
    #SBATCH --ntasks=1
    #SBATCH --cpus-per-task=1
    #SBATCH --output=/home/%u/logs/{job_name}.log
    #SBATCH --mem-per-cpu=8000
    module purge
    module load license_intel
    module load intel/15.0-2
    export LD_LIBRARY_PATH=${{HOME}}/lib/hdf5/lib:$LD_LIBRARY_PATH
    mkdir -p ${{HOME}}/run/${{SLURM_JOB_ID}}
    cd ${{HOME}}/run/${{SLURM_JOB_ID}}
    
    mkdir temp
    mkdir output
    cp ${{HOME}}/options .
    echo '/fjord/jgs/patmosx/Satellite_Input/avhrr/global/n18_2009/' >> list
    echo './output/' >> list
    echo '{file_1b}' >> list
    
    ${{HOME}}/clavrx_trunk/clavrx_bin/clavrxorb -default options -filelist list
    """
    
    files = ['NSS.GHRR.NN.D09001.S0728.E0859.B1864142.GC.gz',
             'NSS.GHRR.NN.D09001.S0853.E1048.B1864243.GC.gz',
             'NSS.GHRR.NN.D09001.S1043.E1232.B1864344.GC.gz',
             ]
    
    for i in range(len(files)):
        job_name = files[i]
        script_name = job_name + '.sbatch'
        with open(script_name, 'w') as f:
            f.write(template.format(job_name=job_name, file_1b=files[i]))
        subprocess.call('sbatch ' + script_name, shell=True)
    
    print('done writing')