<commit_before>from datetime import datetime
import urllib
import urllib2
import bz2
from osgeo import gdal
from osgeo import osr
import numpy as np
import ocfiledates
from dateutil.relativedelta import relativedelta

class Chl:
	"""
	This is my CHL class
	"""

	def __init__(self, start_date, end_date, res, time_composite='Annual'):
		
		self.start_date     = start_date
		self.end_date       = end_date
		self.res            = res
		self.time_composite = time_composite

		if self.res == 4:
			self.geo = [-180.0, 0.04166666791, 0.0, 90.0, 0.0, -0.04166666791]
		elif self.res == 9:
			self.geo = [-180.0, 0.08333333582, 0.0, 90.0, 0.0, -0.08333333582]

    		self.outproj = osr.SpatialReference()
    		self.outproj.SetWellKnownGeogCS("WGS84")    
    		self.nodata = -32767


	def download(self, path):
		"""
		This downloads
	
		"""
		failed_files = []
		self.path = path
		filenames = self.__createfilenames()
		for f in filenames:
			f_uncompress = self.__extract(f)
			if not f_uncompress == 1:
				self.__process(f_uncompress)
			else:
				failed_files.append(f)
		
		if len(failed_files) >= 1:
			return failed_files
		else:
			return 0


	def __createfilenames(self):
		"""
		Creates a list of filenames based on inputs 
		"""
		minyear = self.start_date.year
		maxyear = self.end_date.year

		leap_years = [x for x in range(minyear, maxyear+1) 
			if (x % 400 == 0) or (x % 4 == 0 and not x % 100 == 0)]
	
		filenames = []
		if self.time_composite == 'Annual':

			minyear = self.start_date.year
			maxyear = self.end_date.year

			for year in range(minyear, maxyear + 1):
				if year in leap_years:
					filenames.append('A{0}001{0}366.L3m_YR_CHL_chlor_a_{1}km'.format(year, self.res))
				else:
					filenames.append('A{0}001{0}364.L3m_YR_CHL_chlor_a_{1}km'.format(year, self.res))
		
		if self.time_composite == 'Monthly':
			d = self.start_date
			while d <= self.end_date:
				m = d.month
				if d.year in leap_years:<commit_msg>Ammended so it works again<commit_after>from datetime import datetime
import urllib
import urllib2
import bz2
from osgeo import gdal
from osgeo import osr
import numpy as np
import ocfiledates
from dateutil.relativedelta import relativedelta

class Chl:
	"""
	This is my CHL class
	"""

	def __init__(self, start_date, end_date, res, time_composite='Annual'):
		
		self.start_date     = start_date
		self.end_date       = end_date
		self.res            = res
		self.time_composite = time_composite

		if self.res == 4:
			self.geo = [-180.0, 0.04166666791, 0.0, 90.0, 0.0, -0.04166666791]
		elif self.res == 9:
			self.geo = [-180.0, 0.08333333582, 0.0, 90.0, 0.0, -0.08333333582]

    		self.outproj = osr.SpatialReference()
    		self.outproj.SetWellKnownGeogCS("WGS84")    
    		self.nodata = -32767


	def download(self, path):
		"""
		This downloads
	
		"""
		failed_files = []
		self.path = path
		filenames = self.__createfilenames()
		for f in filenames:
			f_uncompress = self.__extract(f)
			if not f_uncompress == 1:
				self.__process(f_uncompress)
			else:
				failed_files.append(f)
		
		if len(failed_files) >= 1:
			return failed_files
		else:
			return 0


	def __createfilenames(self):
		"""
		Creates a list of filenames based on inputs 
		"""
		minyear = self.start_date.year
		maxyear = self.end_date.year

		leap_years = [x for x in range(minyear, maxyear+1) 
			if (x % 400 == 0) or (x % 4 == 0 and not x % 100 == 0)]
	
		filenames = []
		if self.time_composite == 'Annual':

			minyear = self.start_date.year
			maxyear = self.end_date.year

			for year in range(minyear, maxyear + 1):
				if year in leap_years:
					filenames.append('A{0}001{0}366.L3m_YR_CHL_chlor_a_{1}km'.format(year, self.res))
				else:
					filenames.append('A{0}001{0}365.L3m_YR_CHL_chlor_a_{1}km'.format(year, self.res))
		
		if self.time_composite == 'Monthly':
			d = self.start_date
			while d <= self.end_date:
				m = d.month
				if d.year in leap_years:
{'fraction_non_alphanumeric': 0.1187611978500128, 'fraction_numerical': 0.0593805989250064, 'mean_word_length': 3.126715945089757, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6866975', 'n_tokens_mistral': 1859, 'n_tokens_neox': 1504, 'n_words': 355}