def create_bat():
    proj = '+proj=cea +lon_0=0 +lat_ts=30 +x_0=0 +y_0=0 +datum=WGS84 +ellps=WGS84 +units=m +no_defs'
    with open('project_to_behrmann.bat', 'w') as bat:
        for (r, dirs, files) in os.walk(root):
            for f in files:
                (n, ext) = os.path.splitext(f)
                if (ext == '.asc'):
                    temptiff = os.path.join(output, (n + '.tiff'))
                    bat.write(('gdalwarp -of GTiff -multi -srcnodata %s -dstnodata %s -t_srs "%s" "%s" "%s"\n' % (nodata, proj, os.path.join(r, f), temptiff)))
                    outdir = r.replace(root, output)
                    if (not os.path.exists(outdir)):
                        os.makedirs(outdir)
                    bat.write(('gdal_translate -of AAIGrid "%s" "%s"\n' % (temptiff, os.path.join(outdir, f))))
                    bat.write(('del "%s"\n' % temptiff))
def create_bat():
    proj = '+proj=cea +lon_0=0 +lat_ts=30 +x_0=0 +y_0=0 +datum=WGS84 +ellps=WGS84 +units=m +no_defs'
    with open('project_to_behrmann.bat', 'w') as bat:
        for (r, dirs, files) in os.walk(root):
            for f in files:
                (n, ext) = os.path.splitext(f)
                if (ext == '.asc'):
                    temptiff = os.path.join(output, (n + '.tiff'))
                    bat.write(('gdalwarp -of GTiff -multi -srcnodata %s -dstnodata %s -t_srs "%s" "%s" "%s"\n' % (nodata, proj, os.path.join(r, f), temptiff)))
                    outdir = r.replace(root, output)
                    if (not os.path.exists(outdir)):
                        os.makedirs(outdir)
                    bat.write(('gdal_translate -of AAIGrid "%s" "%s"\n' % (temptiff, os.path.join(outdir, f))))
                    bat.write(('del "%s"\n' % temptiff))