Skip to content

Add catalog_type to Catalog to track catalog type of read STACs. #224

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

Merged
merged 1 commit into from
Oct 29, 2020

Conversation

lossyrob
Copy link
Member

This PR adds a catalog_type as an attribute to Catalog. This is determined when reading in a catalog through inspecting the links.

Before this change, the save method on Catalog always requires a CatalogType supplied as an argument. This change determines the catalog type of a catalog that is read in by examining its Links and carries that information on the object, so that if a catalog_type is set on the catalog, it does not need to be supplied as an argument for the save call.

This is useful for users who want to read in a catalog, make a change (say, add some items), and save back the catalog, without having to think about what the original catalog type was.

@lossyrob lossyrob force-pushed the feature/rde/catalog_type branch from 0379518 to 1728d71 Compare October 29, 2020 16:22
@codecov-io
Copy link

Codecov Report

Merging #224 into develop will increase coverage by 0.01%.
The diff coverage is 95.45%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #224      +/-   ##
===========================================
+ Coverage    93.19%   93.20%   +0.01%     
===========================================
  Files           29       29              
  Lines         3557     3577      +20     
===========================================
+ Hits          3315     3334      +19     
- Misses         242      243       +1     
Impacted Files Coverage Δ
pystac/catalog.py 94.78% <95.45%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 58e45fb...1728d71. Read the comment docs.

Before this change, the save method on Catalog always requires a
CatalogType supplied as an argument. This change determines the
catalog type of a catalog that is read in by examining its Links and
carries that information on the object, so that if a catalog_type is
set on the catalog, it does not need to be supplied as an argument for
the save call.
@lossyrob lossyrob force-pushed the feature/rde/catalog_type branch from 1728d71 to 11e03fb Compare October 29, 2020 16:34
@lossyrob lossyrob merged commit 9236d7d into develop Oct 29, 2020
@lossyrob lossyrob deleted the feature/rde/catalog_type branch October 29, 2020 18:31
lossyrob added a commit that referenced this pull request Oct 29, 2020
As a follow-up to #224, set the catalog_type in Collection.to_dict
similar to how it is set in Catalog.to_dict.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants