-
Notifications
You must be signed in to change notification settings - Fork 256
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
Ref/remote download #598
Ref/remote download #598
Changes from all commits
97e4488
102d76f
e5c149f
9d4172e
88348c2
cc27951
2818916
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
import SimPEG.PF as PF | ||
from SimPEG import Maps, Regularization, Optimization, DataMisfit,\ | ||
InvProblem, Directives, Inversion | ||
from SimPEG.Utils.io_utils import remoteDownload | ||
from SimPEG.Utils.io_utils import download | ||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
|
||
|
@@ -25,14 +25,15 @@ def run(plotIt=True, cleanAfterRun=True): | |
|
||
# Start by downloading files from the remote repository | ||
url = "https://storage.googleapis.com/simpeg/Chile_GRAV_4_Miller/" | ||
cloudfiles = ['LdM_grav_obs.grv', 'LdM_mesh.mesh', | ||
'LdM_topo.topo', 'LdM_input_file.inp'] | ||
|
||
basePath = os.path.sep.join(os.path.abspath(os.getenv('HOME')).split | ||
(os.path.sep)+['Downloads']+['SimPEGtemp']) | ||
basePath = os.path.abspath(remoteDownload(url, | ||
cloudfiles, | ||
basePath=basePath+os.path.sep)) | ||
cloudfiles = [ | ||
'LdM_grav_obs.grv', 'LdM_mesh.mesh', | ||
'LdM_topo.topo', 'LdM_input_file.inp' | ||
] | ||
|
||
# Download to Downloads/SimPEGtemp | ||
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. Here we are not specifying where things get put? I think they should just go directly into Can we just rename this to file_names = download([url1, url2], folder='~/Downloads/mag_stuff', overwrite=True)
# or
file_name = download(url1)
# where
assert isinstance(file_names, list)
assert len(file_names) == 2
assert isinstance(file_name, str) I think that the default should the the pwd of where the python file is run from, appending a 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. This also would mean that you don't have to reconstruct the file name after the fact, you just loop through the list: with open(file_name, 'r') as f:
f.read()
with open(file_names[0], 'r') as f2:
f2.read() 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.
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. I think that it could be both? You can call folder='here'
folder='or/here'
folder='/Users/rowan/downloads/or/even/here' I see all of these as folders? 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. ok, fair enough, folder can work |
||
basePath = os.path.expanduser('~/Downloads/simpegtemp') | ||
download([url+f for f in cloudfiles], folder=basePath, overwrite=True) | ||
|
||
input_file = basePath + os.path.sep + 'LdM_input_file.inp' | ||
# %% User input | ||
# Plotting parameters, max and min densities in g/cc | ||
|
@@ -70,8 +71,9 @@ def run(plotIt=True, cleanAfterRun=True): | |
static = driver.staticCells | ||
dynamic = driver.dynamicCells | ||
|
||
staticCells = Maps.InjectActiveCells(None, | ||
dynamic, driver.m0[static], nC=nC) | ||
staticCells = Maps.InjectActiveCells( | ||
None, dynamic, driver.m0[static], nC=nC | ||
) | ||
mstart = driver.m0[dynamic] | ||
|
||
# Get index of the center | ||
|
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.
this is just white-space