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

Minor edits required to get it running #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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 DSSAT_WTH.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
import shutil
import pandas as pd
from datetime import datetime, date, timedelta
from chirps import *
from .CHIRPS import *
import joblib
from getnasap import nasa, nasachirps
from .getnasap import nasa, nasachirps

def dssat_wth(in_file, startDate, endDate, out_dir):
s1 = datetime.now()
Expand Down
Empty file added __init__.py
Empty file.
6 changes: 3 additions & 3 deletions __main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

import sys
import argparse
from dssat_wth import dssat_wth
from update_wth import update_wth
from .DSSAT_WTH import dssat_wth
from .update_wth import update_wth

def main():
parser = argparse.ArgumentParser()
Expand All @@ -34,4 +34,4 @@ def main():
update_wth(args.in_file, args.in_dir, args.out_dir)

if __name__ == "__main__":
sys.exit(main())
sys.exit(main())
Binary file added __pycache__/CHIRPS.cpython-39.pyc
Binary file not shown.
Binary file added __pycache__/DSSAT_WTH.cpython-39.pyc
Binary file not shown.
Binary file added __pycache__/__init__.cpython-39.pyc
Binary file not shown.
Binary file added __pycache__/__main__.cpython-39.pyc
Binary file not shown.
Binary file added __pycache__/getnasap.cpython-39.pyc
Binary file not shown.
Binary file added __pycache__/main.cpython-39.pyc
Binary file not shown.
Binary file added __pycache__/update_wth.cpython-39.pyc
Binary file not shown.
4 changes: 2 additions & 2 deletions getnasap.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def check_files(user_input, nasa_outdir):
return False

#Function to check that all NASAPOWER files requested are downloaded.
def get_data2(user_input, cf):
def get_data2(user_input, cf, startDate, endDate, nasa_outdir):

if cf[2] < cf[1]:
print(cf[1] - cf[2], "missing file(s):", cf[0])
Expand All @@ -121,7 +121,7 @@ def nasa(user_input, startDate, endDate, nasa_outdir):
get_data(user_input, startDate, endDate, nasa_outdir)
cf = check_files(user_input, nasa_outdir) #To check that all files requested were downloaded.
if cf:
get_data2(user_input, cf)
get_data2(user_input, cf, startDate, endDate, nasa_outdir)
if check_files(user_input, nasa_outdir):
print('Program terminated. Please check manually NASAPOWER server response.')
sys.exit(1)
Expand Down
4 changes: 2 additions & 2 deletions update_wth.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
import shutil
import pandas as pd
from datetime import datetime, date, timedelta
from chirps import *
from .CHIRPS import *
import joblib
from getnasap import nasa, nasachirps
from .getnasap import nasa, nasachirps

#Select requested (.WTH) files from historical repository and copy them to a new folder.
def sel_wthfiles(in_file, in_dir, outdir_hist):
Expand Down