-
Notifications
You must be signed in to change notification settings - Fork 136
Add config & CLI support for .ftml path in mssautoplot #2814
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
Open
annapurna-gupta
wants to merge
5
commits into
Open-MSS:develop
Choose a base branch
from
annapurna-gupta:ehnance/autoplot
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
aa48b21
added path and option to overwite
annapurna-gupta 798483c
update changes
annapurna-gupta 6ebace2
Added path for .ftml
annapurna-gupta 47a86e2
improve path handeling
annapurna-gupta eb95105
Merge branch 'develop' into ehnance/autoplot
ReimarBauer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -62,6 +62,7 @@ | |
| from mslib.utils.auth import get_auth_from_url_and_name | ||
| from mslib.utils.loggerdef import configure_mpl_logger | ||
| from mslib.utils.verify_user_token import verify_user_token | ||
| from mslib.msui.constants import DEFAULT_FTML_PATH | ||
|
|
||
|
|
||
| TEXT_CONFIG = { | ||
|
|
@@ -234,15 +235,14 @@ def __init__(self, cpath, msc_url=None, msc_auth_password=None, username=None, p | |
| if filename != "" and filename == flight: | ||
| self.read_operation(flight, msc_url, msc_auth_password, username, password) | ||
| elif filename != "": | ||
| # Todo add the dir to the file in the mssautoplot.json | ||
| dirpath = "./" | ||
| file_path = os.path.join(dirpath, filename) | ||
| file_path = DEFAULT_FTML_PATH | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use the users config of mss_dir |
||
| exists = os.path.exists(file_path) | ||
| if not exists: | ||
| print("Filename {} doesn't exist".format(filename)) | ||
| self.pdlg.close() | ||
| if self.pdlg: | ||
| self.pdlg.close() | ||
| raise SystemExit("Filename {} doesn't exist".format(filename)) | ||
| self.read_ftml(filename) | ||
| self.read_ftml(DEFAULT_FTML_PATH) | ||
|
|
||
| def setup(self): | ||
| pass | ||
|
|
@@ -260,7 +260,7 @@ def update_path(self, filename=None): | |
| """ | ||
| # plot path and label | ||
| if filename != "": | ||
| self.read_ftml(filename) | ||
| self.read_ftml(DEFAULT_FTML_PATH) | ||
| self.fig.canvas.draw() | ||
| self.plotter.update_from_waypoints(self.wp_model_data) | ||
| self.plotter.redraw_path(waypoints_model_data=self.wp_model_data) | ||
|
|
@@ -275,6 +275,8 @@ def update_path_ops(self, filename=None): | |
| self.plotter.redraw_path(waypoints_model_data=self.wp_model_data) | ||
|
|
||
| def read_ftml(self, filename): | ||
| if filename is None: | ||
| filename = DEFAULT_FTML_PATH | ||
| self.wps, self.wp_model_data = load_from_ftml(filename) | ||
| self.wp_lats, self.wp_lons, self.wp_locs = [[x[i] for x in self.wps] for i in [0, 1, 3]] | ||
| self.wp_press = [mslib.utils.thermolib.flightlevel2pressure(wp[2] * units.hft).to("Pa").m for wp in self.wps] | ||
|
|
@@ -411,7 +413,7 @@ def update_path(self, filename=None): | |
| """ | ||
| # plot path and label | ||
| if filename != "": | ||
| self.read_ftml(filename) | ||
| self.read_ftml(DEFAULT_FTML_PATH) | ||
| self.fig.canvas.draw() | ||
| self.plotter.update_from_waypoints(self.wp_model_data) | ||
| indices = list(zip(self.intermediate_indexes, self.wp_press)) | ||
|
|
@@ -509,7 +511,7 @@ def setup(self): | |
| def update_path(self, filename=None): | ||
| self.setup() | ||
| if filename != "": | ||
| self.read_ftml(filename) | ||
| self.read_ftml(DEFAULT_FTML_PATH) | ||
|
|
||
| highlight = [[wp[0], wp[1]] for wp in self.wps] | ||
| self.myfig.draw_vertical_lines(highlight, self.lats, self.lons) | ||
|
|
@@ -582,7 +584,7 @@ def draw(self, flight, section, vertical, filename, init_time, time, url, layer, | |
| @click.command() | ||
| @click.option('--cpath', default=constants.MSS_AUTOPLOT, help='Path of the configuration file.') | ||
| @click.option('--view', default="top", help='View of the plot (top/side/linear).') | ||
| @click.option('--ftrack', default="", help='Flight track.') | ||
| @click.option('--ftrack', type=click.Path(exists=True), help='Path to the .ftml file') | ||
| @click.option('--itime', default="", help='Initial time.') | ||
| @click.option('--vtime', default="", help='Valid time.') | ||
| @click.option('--intv', default=0, help='Time interval.') | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use the users config var mss_dir, and don't create a new constant
or investigate how it stores the first used dir.
e.g. when you store in a ftml dir, it uses that dir for e.g. an import
it should not behave different to the common user interface.
look for self.last_save_directory