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

Compute tidal currents - variale referenced before assignment #112

Closed
RGFell opened this issue Oct 3, 2022 · 2 comments
Closed

Compute tidal currents - variale referenced before assignment #112

RGFell opened this issue Oct 3, 2022 · 2 comments

Comments

@RGFell
Copy link

RGFell commented Oct 3, 2022

Hi all,

I'm trying to obtain the u and v components of the tidal current at a fixed point from the attached CSV file. But after I run compute_tidal_current.py as follows:

compute_tidal_currents.py erebus_2017_2019_hourly.csv erebus_current.csv --tide 'CATS2008' --directory /home/UOCNT/rag110/ --variables y x time --header 1 --type 'drift' -projection 4326

I got this error. I tried to trace it and see if I made something wrong but could not find anything so far. Maybe my call to the program is wrong?

Traceback (most recent call last):
  File "/home/UOCNT/rag110/anaconda3/envs/pytmd-env/bin/compute_tidal_currents.py", line 515, in <module>
    main()
  File "/home/UOCNT/rag110/anaconda3/envs/pytmd-env/bin/compute_tidal_currents.py", line 503, in main
    compute_tidal_currents(args.directory, args.infile, args.outfile,
  File "/home/UOCNT/rag110/anaconda3/envs/pytmd-env/bin/compute_tidal_currents.py", line 244, in compute_tidal_currents
    dinput = pyTMD.spatial.from_ascii(input_file, columns=VARIABLES,
  File "/home/UOCNT/rag110/anaconda3/envs/pytmd-env/lib/python3.9/site-packages/pyTMD/spatial.py", line 160, in from_ascii
    for i,line in enumerate(file_contents[header:]):
UnboundLocalError: local variable 'header' referenced before assignment

Thanks for your help.

erebus_2017_2019_hourly.csv

tsutterley added a commit that referenced this issue Oct 3, 2022
feat: added delimiter option and datetime parsing in spatial class
@tsutterley
Copy link
Owner

Hi @RGFell,
Some of these were fixed prior but I haven't made an update to conda forge (which I will do today).

But I also needed to make some updates so that you could read ISO formatted dates from ascii files. These updates are in #113.

You should (once I merge this and put together the pypi+conda forge release) be able to run this as

compute_tidal_currents.py --tide 'CATS2008' --directory /home/UOCNT/rag110/ \
    --variables y x time --header 1 --type 'drift' --projection 4326 \
    --standard datetime --extrapolate erebus_2017_2019_hourly.csv erebus_current.csv 

erebus_current.csv

@RGFell
Copy link
Author

RGFell commented Oct 3, 2022

Excellent!, thanks very much for the help.

@RGFell RGFell closed this as completed Oct 3, 2022
tsutterley added a commit that referenced this issue Oct 3, 2022
feat: added delimiter option and datetime parsing in spatial class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants