<commit_before>import numpy as np
import netCDF4 as n
import itertools
from django.contrib.gis.db.models.query import GeoValuesListQuerySet


class NetCdfAccessor(object):
    """
    Access netCDF4 Dataset objects for profiling and conversion.
    
    rootgrp -- base netCDF4.Dataset object.
    var -- name of the variable to extract. ie. 'Tavg'
    **kwds -- customizable NC attribute names. see object's __init__ method for
        explanation.
    """

    
    def __init__(self,rootgrp,var,**kwds):
        self.rootgrp = rootgrp
        self.var = var

        ## KEYWORD EXTRACTION --------------------------------------------------

        self.time = kwds.get('time') or 'time'
        self.srid = kwds.get('srid') or 4326
        self.nodata_var = kwds.get('nodata') or 'missing_value'
        
        ## ---------------------------------------------------------------------
        
        ## pull the nodata value
        try:
            self.nodata = getattr(rootgrp.variables[self.var],self.nodata_var)
        except AttributeError:
            self.nodata = None
        ## construct the time vector
        times = self.rootgrp.variables[self.time]
        self._timevec = n.num2date(times[:],units=times.units,calendar=times.calendar)
                        
    def get_pyfrmt(self,val):<commit_msg>before modifying profiler.<commit_after>import numpy as np
import netCDF4 as n
import itertools
from django.contrib.gis.db.models.query import GeoValuesListQuerySet


class NetCdfAccessor(object):
    """
    Access netCDF4 Dataset objects for profiling and conversion.
    
    rootgrp -- base netCDF4.Dataset object.
    var_name -- name of the variable to extract. ie. 'Tavg'
    **kwds -- customizable NC attribute names. see object's __init__ method for
        explanation.
    """

    
    def __init__(self,rootgrp,var_name,**kwds):
        self.rootgrp = rootgrp
        self.var_name = var_name
        self.variable = self.rootgrp.variables[var_name]

        ## KEYWORD EXTRACTION --------------------------------------------------

        self.time = kwds.get('time') or 'time'
        self.srid = kwds.get('srid') or 4326
        self.nodata_var = kwds.get('nodata') or 'missing_value'
        
        ## ---------------------------------------------------------------------
        
        ## pull the nodata value
        try:
            self.nodata = getattr(rootgrp.variables[self.var],self.nodata_var)
        except AttributeError:
            self.nodata = None
        ## construct the time vector
        times = self.rootgrp.variables[self.time]
        self._timevec = n.num2date(times[:],units=times.units,calendar=times.calendar)
                        
    def get_pyfrmt(self,val):
{'fraction_non_alphanumeric': 0.17541940189642596, 'fraction_numerical': 0.005835156819839533, 'mean_word_length': 1.743, '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': '1059850', 'n_tokens_mistral': 770, 'n_tokens_neox': 763, 'n_words': 181}