Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Adding extract_subset_granule #86

Merged
merged 6 commits into from
Oct 23, 2016
Merged

Adding extract_subset_granule #86

merged 6 commits into from
Oct 23, 2016

Conversation

Omkar20895
Copy link
Collaborator

@Omkar20895 Omkar20895 commented Oct 21, 2016

  • This function iterates continuously for the given job token and downloads it as soon as the job is done.
  • I am facing an issue after downloading and extracting the zip file

error : zipfile.BadZipfile: File is not a zip file

I tried to remove this error but couldn't I would like to use some fresh perspective. Pardon me if the error was caused by something silly. Ok Thanks. :)

this closes #82

@lewismc
Copy link
Member

lewismc commented Oct 21, 2016

Hi @Omkar20895 can you please shift this new function into the granule_subset function rather than creating yet another function? The idea is to keep the core Podaacpy functions exactly as specified within the Podaac Webservices API Specification. The core fucntion names can be seen on the README.
If you could please update the PR then i will check it out and also implement the test function.
Thank you v much for submitting ht patch Omkar.

@Omkar20895
Copy link
Collaborator Author

@lewismc sure thing!

@Omkar20895
Copy link
Collaborator Author

Done! Don't mind the commits, I will squash them at the end.

print("Done! downloading the dataset zip .....")
download_url = subset_response_json['resultURLs'][0]
if path == '':
path = os.path.join(os.path.dirname(__file__), 'dataset.zip')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please grab the dataset name correctly from the download_url and append the .zip to this name.

@Omkar20895
Copy link
Collaborator Author

@lewismc Done! Apparently I did a silly mistake in my code, it works fine now. Thanks. :)

path = path + zip_file_name
response = urlretrieve(download_url, path)
zip_content = zipfile.ZipFile(path)
z.extractall()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Veriable Z does not exist yet. Also I wonder if we can create a small unit test? This is looking great BTW @Omkar20895 .

@Omkar20895
Copy link
Collaborator Author

oh shoot! pardon me, I don't know what's wrong with me 😅 I will update it with a unit test and everything should be fine then. Thanks.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 95.582% when pulling e1d7ddd on Omkar20895:master into 124e499 on lewismc:master.

1 similar comment
@coveralls
Copy link

coveralls commented Oct 23, 2016

Coverage Status

Coverage decreased (-0.2%) to 95.582% when pulling e1d7ddd on Omkar20895:master into 124e499 on lewismc:master.

@lewismc
Copy link
Member

lewismc commented Oct 23, 2016

+1 Omkar please merge with master. We can release podaacpy 1.5.0 and make the upgrade over in OCW. this is the best functionality yet in podaacpy thank you for working on this.

@Omkar20895 Omkar20895 merged commit d3bdfc7 into nasa:master Oct 23, 2016
@Omkar20895
Copy link
Collaborator Author

No problems. Thank you very much! :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Downloading subsetted dataset from PO.DAAC
3 participants