Skip to content
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

Document footprint links #229

Merged
merged 3 commits into from
Oct 26, 2023
Merged

Document footprint links #229

merged 3 commits into from
Oct 26, 2023

Conversation

ian-r-rose
Copy link
Member

@ian-r-rose ian-r-rose commented Oct 26, 2023

Fixes #222.

I used the following Python snippet to help generate the doc table:

import s3fs
import pandas

fs = s3fs.S3FileSystem(anon=True)

fips = pandas.read_csv("https://github.com/kjhealy/fips-codes/raw/master/state_and_county_fips_master.csv")
fips = fips[fips.state == "CA"].assign(fips=fips.fips.astype(str).str.slice(-3))

global_ml_parquet = sorted(
    fs.glob(
        "s3://dof-demographics-dev-us-west-2-public/"
        "global_ml_building_footprints/parquet/**.parquet"
    )
)
global_ml_parquet = ["s3://" + p for p in global_ml_parquet]

global_ml_zip = sorted(
    fs.glob(
        "s3://dof-demographics-dev-us-west-2-public/"
        "global_ml_building_footprints/shp/**.zip"
    )
)
global_ml_zip = ["s3://" + p for p in global_ml_zip]

lines = []
lines.append("| County | GeoParquet (HTTPS) | Shapefile (HTTPS) | GeoParquet (S3) | Shapefile (S3) |")
lines.append("| -------| ------------------ | ----------------- | --------------- | ---------------|")

domain = "https://dof-demographics-dev-us-west-2-public.s3.us-west-2.amazonaws.com/"

for p, s in zip(global_ml_parquet, global_ml_zip):
    county = fips[fips.fips == p.split(".")[-2].split("_")[-1]].iloc[0]["name"]
    hp = domain + "/".join(p.split("/")[-3:])
    hs = domain + "/".join(s.split("/")[-3:])
    lines.append(f"| {county} | [URL]({hp}) | [URL]({hs}) | [URL]({p}) | [URL]({s}) |")

Built docs here

@ian-r-rose
Copy link
Member Author

cc @fennisreed for feedback

removed "County" from each county name as it was repetitive and may make parsing/reading through the table harder and it is already denoted by the column header
Copy link
Contributor

@britt-allen britt-allen left a comment

Choose a reason for hiding this comment

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

This all looks efficient and great. Thanks for creating this so quickly, @ian-r-rose !

@ian-r-rose
Copy link
Member Author

ian-r-rose commented Oct 26, 2023 via email

@britt-allen
Copy link
Contributor

We both ran into the same failure on our commits, I am not sure how mine introduced anything new? @ian-r-rose

@ian-r-rose
Copy link
Member Author

We both ran into the same failure on our commits, I am not sure how mine introduced anything new? @ian-r-rose

This was the python issue in #231, it should work now

@britt-allen
Copy link
Contributor

Yes I saw that right after I commented, I misunderstood.

Copy link
Contributor

@britt-allen britt-allen left a comment

Choose a reason for hiding this comment

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

Nice catch, ty!

@britt-allen britt-allen merged commit 290ac20 into main Oct 26, 2023
2 checks passed
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.

Generate HTML file with download links for building footprints
2 participants