Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update noaa_forecast.py #235

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tools/noaa_forecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
float_format = "%.1f"
date_format = "%Y-%m-%d %H:%M:%S"
max_retries = 5
position = None

def getforecast(lat,lon):
"""Get NOAA location"""
Expand Down Expand Up @@ -174,7 +175,7 @@ def writeglm(data, glm=sys.stdout, name=None, csv=None,download_now=True):
glm.write("}\n")
data.columns = list(map(lambda x:x.split('[')[0],data.columns))
glm.write("module tape;\n")
glm.write("#define NOAA_FORECAST_TIMEZONE=${SHELL gridlabd timezone local}\n")
glm.write(f"#define NOAA_FORECAST_TIMEZONE=${{SHELL gridlabd timezone {','.join(position)} -f=TZSPEC}}\n")
glm.write(f"#define NOAA_FORECAST_STARTTIME={data.index.min().isoformat('T')}\n")
glm.write(f"#define NOAA_FORECAST_STOPTIME={data.index.max().isoformat('T')}\n")
glm.write("object forecast\n{\n")
Expand Down Expand Up @@ -207,7 +208,6 @@ def syntax(code=0):
else:
print(f"Syntax: {os.path.basename(sys.argv[0]).replace('.py','')} -p -position=LAT,LON [-i|--interpolate=TIME|METHOD] [-g|--glm=GLMNAME] [-n|--name=OBJECTNAME] [-c|--csv=CSV] [--test] [-h|--help|help]")
exit(code)
position = None
glm = None
name = None
csv = None
Expand Down
Loading