Skip to content
Snippets Groups Projects
Commit 238ba441 authored by mads's avatar mads
Browse files

apply lower to filenames

parent 266b349f
No related branches found
No related tags found
No related merge requests found
...@@ -14,8 +14,6 @@ from io import open ...@@ -14,8 +14,6 @@ from io import open
from builtins import str from builtins import str
from future import standard_library from future import standard_library
from wetb.utils.process_exec import pexec from wetb.utils.process_exec import pexec
from wetb.gtsdf.unix_time import from_unix
standard_library.install_aliases() standard_library.install_aliases()
from collections import OrderedDict from collections import OrderedDict
...@@ -71,7 +69,7 @@ class HTCFile(HTCContents, HTCDefaults): ...@@ -71,7 +69,7 @@ class HTCFile(HTCContents, HTCDefaults):
def readfilelines(self, filename): def readfilelines(self, filename):
with open(filename, encoding='cp1252') as fid: with open(filename.lower(), encoding='cp1252') as fid:
lines = list(fid.readlines()) lines = list(fid.readlines())
if lines[0].encode().startswith(b'\xc3\xaf\xc2\xbb\xc2\xbf'): if lines[0].encode().startswith(b'\xc3\xaf\xc2\xbb\xc2\xbf'):
lines[0] = lines[0][3:] lines[0] = lines[0][3:]
...@@ -255,6 +253,27 @@ class HTCFile(HTCContents, HTCDefaults): ...@@ -255,6 +253,27 @@ class HTCFile(HTCContents, HTCDefaults):
if errorcode or 'Elapsed time' not in log: if errorcode or 'Elapsed time' not in log:
raise Exception (str(stdout) + str(stderr)) raise Exception (str(stdout) + str(stderr))
class H2aeroHTCFile(HTCFile):
def __init__(self, filename=None, modelpath="../"):
HTCFile.__init__(self, filename=filename, modelpath=modelpath)
@property
def simulation(self):
return self.test_structure
def set_time(self, start=None, stop=None, step=None):
if stop is not None:
self.test_structure.time_stop = stop
else:
stop = self.simulation.time_stop[0]
if step is not None:
self.test_structure.deltat = step
if start is not None:
self.output.time = start, stop
if "wind" in self and self.wind.turb_format[0] > 0:
self.wind.scale_time_start = start
if "__main__" == __name__: if "__main__" == __name__:
f = HTCFile(r"C:\mmpe\HAWC2\models\DTU10MWRef6.0\htc\DTU_10MW_RWT_power_curve.htc", "../") f = HTCFile(r"C:\mmpe\HAWC2\models\DTU10MWRef6.0\htc\DTU_10MW_RWT_power_curve.htc", "../")
f.save(r"C:\mmpe\HAWC2\models\DTU10MWRef6.0\htc\DTU_10MW_RWT_power_curve.htc") f.save(r"C:\mmpe\HAWC2\models\DTU10MWRef6.0\htc\DTU_10MW_RWT_power_curve.htc")
......
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