<commit_before>#!/usr/bin/env python

import logging
LOG_LEVEL = logging.INFO
logging.basicConfig(level=LOG_LEVEL)

import cdms2
import copy
import sys
import os
import json
import pcmdi_metrics
from pcmdi_metrics.pcmdi.pmp_parser import PMPParser
import collections
from collections import defaultdict

from EnsoMetrics.EnsoMetricsLib import EnsoAmpl, EnsoMu
from EnsoMetrics.pmpParser import ReadOptions

#########################################################
param = ReadOptions()

metrics = param.metrics
ninoBox = param.ninoBox

print metrics
print ninoBox
##########################################################

# Setup where to output resulting ---
try:
    os.mkdir(param.outpathjson)
except BaseException:
    pass

# Insert observation at the beginning of the loop ---
models = copy.copy(param.modnames)
models.insert(0,'obs')

# Dictionary to save result ---
def tree(): return defaultdict(tree)
enso_stat_dic = tree() # Use tree dictionary to avoid declearing everytime

#=================================================
# Loop for Observation and Models 
#-------------------------------------------------
for mod in models:
    print ' ----- ', mod,' ---------------------'
  
    if mod == 'obs':
        sstFile = param.sstObsPath 
        tauxFile = param.tauxObsPath

        sstName = param.sstNameObs
        tauxName = param.tauxNameObs
    else:
        sstFile = (param.modpath.replace('MOD', mod)).replace('VAR',sstName) ## Will need land mask out at some point...!
        tauxFile = (param.modpath.replace('MOD', mod)).replace('VAR',tauxName)

        sstName = param.sstName
        tauxName = param.tauxName

    print sstFile
    print tauxFile
  
    #try:
    if 1:
        for metric in metrics:

            print metric<commit_msg>bug fix for model sst name<commit_after>#!/usr/bin/env python

import logging
LOG_LEVEL = logging.INFO
logging.basicConfig(level=LOG_LEVEL)

import cdms2
import copy
import sys
import os
import json
import pcmdi_metrics
from pcmdi_metrics.pcmdi.pmp_parser import PMPParser
import collections
from collections import defaultdict

from EnsoMetrics.EnsoMetricsLib import EnsoAmpl, EnsoMu
from EnsoMetrics.pmpParser import ReadOptions

#########################################################
param = ReadOptions()

metrics = param.metrics
ninoBox = param.ninoBox

print metrics
print ninoBox
##########################################################

# Setup where to output resulting ---
try:
    os.mkdir(param.outpathjson)
except BaseException:
    pass

# Insert observation at the beginning of the loop ---
models = copy.copy(param.modnames)
models.insert(0,'obs')

# Dictionary to save result ---
def tree(): return defaultdict(tree)
enso_stat_dic = tree() # Use tree dictionary to avoid declearing everytime

#=================================================
# Loop for Observation and Models 
#-------------------------------------------------
for mod in models:
    print ' ----- ', mod,' ---------------------'
  
    if mod == 'obs':
        sstName = param.sstNameObs
        tauxName = param.tauxNameObs

        sstFile = param.sstObsPath 
        tauxFile = param.tauxObsPath
    else:
        sstName = param.sstName
        tauxName = param.tauxName

        sstFile = (param.modpath.replace('MOD', mod)).replace('VAR',sstName) ## Will need land mask out at some point...!
        tauxFile = (param.modpath.replace('MOD', mod)).replace('VAR',tauxName)

    print sstFile
    print tauxFile
  
    #try:
    if 1:
        for metric in metrics:

            print metric
{'fraction_non_alphanumeric': 0.20960944085417252, 'fraction_numerical': 0.0016858668165214948, 'mean_word_length': 3.1299303944315544, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '220323', 'n_tokens_mistral': 1019, 'n_tokens_neox': 980, 'n_words': 284}