Skip to content
Snippets Groups Projects
Commit b3ba8cd8 authored by jacques.grelet_ird.fr's avatar jacques.grelet_ird.fr
Browse files

create roscop module (objetct)

update gitignore
parent fb0bf728
No related branches found
No related tags found
No related merge requests found
......@@ -11,4 +11,5 @@
*.nc
*.xml
*.stackdump
__pycache__
File moved
"""
code roscop
"""
import csv, shelve,sys
# class roscop
# ------------
class Roscop:
# constructor with values by default
def __init__(self, file):
self.file = file
# call by print()
def __repr__(self):
return "class Roscop, file: {}".format(self.file)
# read code roscop file
def read(self):
print("Code roscop file: %s" % self.file)
with open(self.file, 'rt') as f:
reader = csv.DictReader(f, delimiter=';')
for row in reader:
print("%s : %s : %s : %s : %s" % (row['key'], row['long_name'],
row['standard_name'], row['units'], row['format']))
return
# for testing in standalone context
# ---------------------------------
if __name__ == "__main__":
from roscop import Roscop
r = Roscop("code_roscop.csv")
r.read()
print(r)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment