<commit_before>import logging
import unittest
import os
import postproc
import nose.tools
import test_utils
import cmor_source
import cmor_target
import cmor_task

logging.basicConfig(level=logging.DEBUG)

class ifs2cmor_tests(unittest.TestCase):

    def test_postproc_gridmean(self):
        abspath = test_utils.get_table_path()
        targets = cmor_target.create_targets(abspath,"CMIP6")
        source = cmor_source.ifs_source.create(79,128)
        target = [t for t in targets if t.variable == "clwvi" and t.table == "CFday"][0]
        task = cmor_task.cmor_task(source,target)
        command = postproc.create_command(task)
        nose.tools.eq_(command.create_command(),"-setgridtype,regular -daymean -selcode,79")

    def test_postproc_specmean(self):
        testdata = os.path.dirname(__file__) + "/test_data/ifsdata/6hr/ICMSHECE3+199001"
        if(test_utils.is_lfs_ref(testdata)):
            logging.info("Skipping test_postproc_specmean, download test data from lfs first")
            return
        abspath = test_utils.get_table_path()
        targets = cmor_target.create_targets(abspath,"CMIP6")
        source = cmor_source.ifs_source.create(131,128)
        target = [t for t in targets if t.variable == "ua" and t.table == "CFday"][0]
        task = cmor_task.cmor_task(source,target)
        setattr(task,"path",test_data)
        command = postproc.create_command(task)
        nose.tools.eq_(command.create_command(),"-sp2gpl -daymean -selzaxis,hybrid -selmon,1 -selcode,131")

    def test_postproc_daymax(self):
        abspath = test_utils.get_table_path()
        targets = cmor_target.create_targets(abspath,"CMIP6")
        source = cmor_source.ifs_source.create(165,128)
        target = [t for t in targets if t.variable == "sfcWindmax" and t.table == "day"][0]
        task = cmor_task.cmor_task(source,target)
        command = postproc.create_command(task)
        nose.tools.eq_(command.create_command(),"-daymax -setgridtype,regular -selcode,165")

    def test_postproc_tasmax(self):
        abspath = test_utils.get_table_path()
        targets = cmor_target.create_targets(abspath,"CMIP6")
        source = cmor_source.ifs_source.create(201,128)
        target = [t for t in targets if t.variable == "tasmax" and t.table == "Amon"][0]
        task = cmor_task.cmor_task(source,target)
        command = postproc.create_command(task)
        nose.tools.eq_(command.create_command(),"-monmean -daymax -setgridtype,regular -selcode,201")

    def test_postproc_windspeed(self):
        abspath = test_utils.get_table_path()
        targets = cmor_target.create_targets(abspath,"CMIP6")
        source = cmor_source.ifs_source.read("var88=sqrt(sqr(var165)+sqr(var166))")
        target = [t for t in targets if t.variable == "sfcWind" and t.table == "6hrPlevPt"][0]
        task = cmor_task.cmor_task(source,target)<commit_msg>Fixed bug in test fix<commit_after>import logging
import unittest
import os
import postproc
import nose.tools
import test_utils
import cmor_source
import cmor_target
import cmor_task

logging.basicConfig(level=logging.DEBUG)

class ifs2cmor_tests(unittest.TestCase):

    def test_postproc_gridmean(self):
        abspath = test_utils.get_table_path()
        targets = cmor_target.create_targets(abspath,"CMIP6")
        source = cmor_source.ifs_source.create(79,128)
        target = [t for t in targets if t.variable == "clwvi" and t.table == "CFday"][0]
        task = cmor_task.cmor_task(source,target)
        command = postproc.create_command(task)
        nose.tools.eq_(command.create_command(),"-setgridtype,regular -daymean -selcode,79")

    def test_postproc_specmean(self):
        testdata = os.path.dirname(__file__) + "/test_data/ifsdata/6hr/ICMSHECE3+199001"
        if(test_utils.is_lfs_ref(testdata)):
            logging.info("Skipping test_postproc_specmean, download test data from lfs first")
            return
        abspath = test_utils.get_table_path()
        targets = cmor_target.create_targets(abspath,"CMIP6")
        source = cmor_source.ifs_source.create(131,128)
        target = [t for t in targets if t.variable == "ua" and t.table == "CFday"][0]
        task = cmor_task.cmor_task(source,target)
        setattr(task,"path",testdata)
        command = postproc.create_command(task)
        nose.tools.eq_(command.create_command(),"-sp2gpl -daymean -selzaxis,hybrid -selmon,1 -selcode,131")

    def test_postproc_daymax(self):
        abspath = test_utils.get_table_path()
        targets = cmor_target.create_targets(abspath,"CMIP6")
        source = cmor_source.ifs_source.create(165,128)
        target = [t for t in targets if t.variable == "sfcWindmax" and t.table == "day"][0]
        task = cmor_task.cmor_task(source,target)
        command = postproc.create_command(task)
        nose.tools.eq_(command.create_command(),"-daymax -setgridtype,regular -selcode,165")

    def test_postproc_tasmax(self):
        abspath = test_utils.get_table_path()
        targets = cmor_target.create_targets(abspath,"CMIP6")
        source = cmor_source.ifs_source.create(201,128)
        target = [t for t in targets if t.variable == "tasmax" and t.table == "Amon"][0]
        task = cmor_task.cmor_task(source,target)
        command = postproc.create_command(task)
        nose.tools.eq_(command.create_command(),"-monmean -daymax -setgridtype,regular -selcode,201")

    def test_postproc_windspeed(self):
        abspath = test_utils.get_table_path()
        targets = cmor_target.create_targets(abspath,"CMIP6")
        source = cmor_source.ifs_source.read("var88=sqrt(sqr(var165)+sqr(var166))")
        target = [t for t in targets if t.variable == "sfcWind" and t.table == "6hrPlevPt"][0]
        task = cmor_task.cmor_task(source,target)
{'fraction_non_alphanumeric': 0.11576568746740831, 'fraction_numerical': 0.022249261254997394, 'mean_word_length': 3.5848605577689243, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '731710', 'n_tokens_mistral': 2024, 'n_tokens_neox': 1928, 'n_words': 339}