-
Notifications
You must be signed in to change notification settings - Fork 23
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
Urban data demonstrator notebook #3
Conversation
@@ -0,0 +1,397 @@ | |||
{ |
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.
It's ok to fetch local data but where possible we should show how to fetch from remote URLs. I've tried the lines below but it returns a corrupted file.
base_path = "https://metdatasa.blob.core.windows.net/covid19-response-non-commercial/index.html#metoffice_ukv_daily--t1o5m_mean/" url= base_path + "ukv_daily_t1o5m_mean_20150801.nc"filename = url.split('/')[-1]
with fsspec.open(url) as f:
with Path(filename).open('wb') as handle:
handle.write(f.read())
Reply via ReviewNB
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.
Sorry I don't have much experience with doing this kind of thing. Might be worth trying this link - https://metdatasa.blob.core.windows.net/covid19-response-non-commercial/metoffice_ukv_daily/t1o5m_mean/ukv_daily_t1o5m_mean_20150801.nc
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.
I believe I have found a compromise by using urllib to retrieve the netcdf file into the sample_data directory, i.e:
filepath = 'https://metdatasa.blob.core.windows.net/covid19-response-non-commercial/metoffice_ukv_daily/t1o5m_mean/' filename = 'ukv_daily_t1o5m_mean_20150801.nc' urllib.request.urlretrieve(filepath+filename, '../sample_data/' + filename)
I think there are other ways of doing this (e.g. curl or wget), but does assume they are installed on the users system. At least using urllib we can specify it as a dependency in the environment.yml
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.
excellent! urllib request is a nice one.
@@ -0,0 +1,397 @@ | |||
{ |
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.
@svadams Thanks for the contribution. I left some suggestions. Be free to explore them in |
…f storing it. Some improvements to plots
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
@acocac - I made some improvements following your suggestions - can you please take another look when you have time :-) |
@svadams, thanks for the improvements, LGTM! |
A PR for contributing an Urban UKV gridded model data demonstrator notebook to the Environmental AI book. The notebook demonstrates:
Notes:
See Iris docs here: https://scitools-iris.readthedocs.io/en/stable/installing.html