Skip to content

Commit 86fef3d

Browse files
authored
Merge pull request #51 from eodms-sgdot/development
Development
2 parents 95161b1 + 01e6700 commit 86fef3d

File tree

11 files changed

+185
-129
lines changed

11 files changed

+185
-129
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,8 @@ _changes.md
6060
_copyright_check.txt
6161
*.geojson
6262
v3_ideas.md
63+
results/
64+
log/
65+
*.bat
66+
*.ps1
67+
*.code-workspace

README.md

Lines changed: 56 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
EODMS Command-line Interface
1+
EODMS Command-line Interface (EODMS-CLI)
22
============================
33

44
## Overview
55

6-
The **eodms_cli.py** script is used to search, order and download imagery from the EODMS using the REST API (RAPI) service.
6+
The **EODMS-CLI** script is used to search, order and download imagery from the EODMS using the REST API (RAPI) service.
77

88
## Requirements
99

1010
### Python
1111

12-
The eodms_cli.py was designed using **Python 3.7** however it has been tested successfully in Python 3.6.10. Using a version prior to Python 3.6 is not recommended as the script will not work properly.
12+
The EODMS-CLI was designed using **Python 3.7** however it has been tested successfully in Python 3.6.10. Using a version prior to Python 3.6 is not recommended as the script will not work properly.
1313

1414
### Python Packages
1515

@@ -30,26 +30,18 @@ The eodms_cli.py was designed using **Python 3.7** however it has been tested su
3030

3131
1. Clone the repository:
3232

33-
```dos
33+
```bash
3434
> git clone https://github.com/eodms-sgdot/eodms-cli.git
3535
```
3636

3737
2. Install required packages (GDAL not included):
3838

39-
```dos
39+
```bash
4040
> cd eodms-cli
4141
> pip install -r requirements.txt
4242
```
4343

44-
3. Either
45-
46-
- run the batch file and enter values when prompted:
47-
48-
```dos
49-
> eodms_cli.bat
50-
```
51-
52-
- run the script using Python
44+
3. Run the script using Python
5345

5446
```bash
5547
> python eodms_cli.py
@@ -72,6 +64,55 @@ In the config file, you can:
7264

7365
For more in-depth information on the configuration file, visit [Config File](https://github.com/eodms-sgdot/eodms-cli/wiki/Config-File).
7466

67+
## Updating
68+
69+
### Update py-eodms-rapi
70+
71+
If you receive one of these messages when running the eodms-cli, follow the instructions and run `pip install py-eodms-rapi -U`.
72+
73+
```bash
74+
**** WARNING ****
75+
The py-eodms-rapi currently installed is not the latest version.
76+
It is recommended to use the latest version of the package. Please
77+
install it using: 'pip install py-eodms-rapi -U'.
78+
*****************
79+
```
80+
81+
or
82+
83+
```bash
84+
**** ERROR ****
85+
The py-eodms-rapi currently installed is an older version than the
86+
minimum required version. Please install it using: 'pip
87+
install py-eodms-rapi -U'.
88+
*****************
89+
```
90+
91+
### Update eodms-cli
92+
93+
If you need to update the eodms-cli to a new release, follow these steps:
94+
95+
1. Pull from the most recent Github repository
96+
97+
```bash
98+
> cd eodms-cli # your eodms-cli repository file location
99+
> git pull origin main
100+
```
101+
102+
2. Install required packages (GDAL not included):
103+
104+
```bash
105+
> cd eodms-cli
106+
> pip install -r requirements.txt
107+
> pip install py-eodms-rapi -U # get the latest py-eodms-rapi for best functionality
108+
```
109+
110+
3. Run the script using Python
111+
112+
```bash
113+
> python eodms_cli.py
114+
```
115+
75116
## User Guide
76117

77118
For the full instructions on using the eodms_orderdownload script, please visit the [Wiki](https://github.com/eodms-sgdot/eodms-cli/wiki).
@@ -85,7 +126,7 @@ If you have any questions or require support, please contact the EODMS Support T
85126
MIT License
86127

87128
Copyright (c) His Majesty the King in Right of Canada, as
88-
represented by the Minister of Natural Resources, 2023
129+
represented by the Minister of Natural Resources, 2024
89130

90131
Permission is hereby granted, free of charge, to any person obtaining a
91132
copy of this software and associated documentation files (the "Software"),

eodms_cli.bat

Lines changed: 0 additions & 4 deletions
This file was deleted.

eodms_cli.code-workspace

Lines changed: 0 additions & 77 deletions
This file was deleted.

eodms_cli.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
##############################################################################
22
#
33
# Copyright (c) His Majesty the King in Right of Canada, as
4-
# represented by the Minister of Natural Resources, 2023
4+
# represented by the Minister of Natural Resources, 2024
55
#
66
# Licensed under the MIT license
77
# (see LICENSE or <http://opensource.org/licenses/MIT>) All files in the
@@ -13,11 +13,11 @@
1313
__title__ = 'EODMS-CLI'
1414
__author__ = 'Kevin Ballantyne'
1515
__copyright__ = 'Copyright (c) His Majesty the King in Right of Canada, ' \
16-
'as represented by the Minister of Natural Resources, 2023'
16+
'as represented by the Minister of Natural Resources, 2024'
1717
__license__ = 'MIT License'
1818
__description__ = 'Script used to search, order and download imagery from ' \
1919
'the EODMS using the REST API (RAPI) service.'
20-
__version__ = '3.4.2'
20+
__version__ = '3.5.0'
2121
__maintainer__ = 'Kevin Ballantyne'
2222
__email__ = 'eodms-sgdot@nrcan-rncan.gc.ca'
2323

@@ -84,7 +84,7 @@
8484
}
8585
}
8686

87-
min_rapi_version = '1.5.0'
87+
min_rapi_version = '1.7.0'
8888

8989
class Prompter:
9090
"""
@@ -104,6 +104,7 @@ def __init__(self, eod, config_util, params, in_click, testing=False):
104104
"""
105105

106106
self.eod = eod
107+
self.eod.set_prompter(self)
107108
self.reset_col = eod.get_colour(reset=True)
108109
self.config_util = config_util
109110
self.config_info = config_util.get_info()
@@ -1105,9 +1106,9 @@ def print_syntax(self):
11051106
"""
11061107

11071108
print("\nUse this command-line syntax to run the same parameters:")
1108-
cli_syntax = self.build_syntax()
1109-
print(f"{self.eod.path_colour}{cli_syntax}{self.eod.reset_colour}")
1110-
self.logger.info(f"Command-line Syntax: {cli_syntax}")
1109+
self.cli_syntax = self.build_syntax()
1110+
print(f"{self.eod.path_colour}{self.cli_syntax}{self.eod.reset_colour}")
1111+
self.logger.info(f"Command-line Syntax: {self.cli_syntax}")
11111112

11121113
def prompt(self):
11131114
"""
@@ -1695,7 +1696,7 @@ def cli(username, password, input_val, collections, process, filters, dates,
16951696
print(f"\n {__title__}, version {__version__}\n")
16961697
eod_util.EodmsProcess().exit_cli()
16971698

1698-
conf_util = config_util.ConfigUtils()
1699+
conf_util = config_util.ConfigUtils(eod_util.EodmsProcess())
16991700

17001701
if configure:
17011702
conf_util.ask_user(configure)

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
py-eodms-rapi>=1.5.0
1+
py-eodms-rapi>=1.7.0
22
requests>=2.23.0
33
dateparser>=1.0.0
44
geomet>=0.3.0

scripts/config_util.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@
2020

2121
class ConfigUtils:
2222

23-
def __init__(self):
23+
def __init__(self, eod=None):
2424
# Set the configuration filepath
2525
old_config_fn = os.path.join(os.sep, os.path.expanduser('~'), '.eodms',
2626
'eodmscli_config.ini')
2727

2828
self.config_fn = os.path.join(os.sep, os.path.expanduser('~'), '.eodms',
2929
'config.ini')
30+
self.eod = eod
3031

3132
if os.path.exists(old_config_fn):
3233
os.rename(old_config_fn, self.config_fn)

scripts/field.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def add_field(self, **kwargs):
210210
# rapi_title='Spatial Resolution',
211211
# ui_label='Pixel Spacing (Metres)')
212212

213-
def get_eod_fieldnames(self, sort=False):
213+
def get_eod_fieldnames(self, sort=False, lowered=False):
214214
"""
215215
Gets the list of EOD fieldnames.
216216
@@ -219,9 +219,15 @@ def get_eod_fieldnames(self, sort=False):
219219
"""
220220

221221
if sort:
222-
return sorted([f.get_eod_name() for f in self.fields])
222+
if lowered:
223+
return sorted([f.get_eod_name().lower() for f in self.fields])
224+
else:
225+
return sorted([f.get_eod_name() for f in self.fields])
223226
else:
224-
return [f.get_eod_name() for f in self.fields]
227+
if lowered:
228+
return [f.get_eod_name().lower() for f in self.fields]
229+
else:
230+
return [f.get_eod_name() for f in self.fields]
225231

226232
def get_field(self, eod_name):
227233
"""

0 commit comments

Comments
 (0)