NOAA-OWP / hydrofabric

hydrofabric meta-package
https://noaa-owp.github.io/hydrofabric/
MIT License
27 stars 10 forks source link

Model attribute areal coverage discrepancy #254

Open glitt13 opened 6 days ago

glitt13 commented 6 days ago

The model-attributes layer contains fewer divide_id values than the corresponding divides layer.

The below example shows that for comid 6716129, there are 18 unique divide ids in the divides layer, but only 13 in the model-attributes layer. This amounts to 220.5 km^2 represented in the divides layer, whereas the model-attributes layer accounts for 181.4 km^2.

library(hfsubsetR)
library(dplyr)
library(glue)
attr_div <- hfsubsetR::get_subset(comid = "6716129", 
                             lyrs = c("model-attributes","divides"),
                             source   ="s3://lynker-spatial/hydrofabric",
                             hf_version =  '2.1.1',
                             type    = "nextgen",
                             domain  = "conus")

# Combine model attributes with divides
attrs_area <- dplyr::left_join(x=attr_div$`model-attributes`, attr_div$divides, by="divide_id")

# Note that there are additional divide ids inside the divides layer, meaning the model-attributes layer is missing some divide ids
print(glue::glue("Total divide ids inside divides layer: {length(unique(attr_div$divides$divide_id))}"))
print(glue::glue("Total divide ids inside model-attributes layer: {length(unique(attr_div$`model-attributes`$divide_id))}"))

# Total area accounted for in each layer:
print(glue::glue("Total catchment area inside the divides layer: {sum(attr_div$divides$areasqkm)} km^2"))

print(glue::glue("Total catchment area inside the model-attributes layer: {sum(attrs_area$areasqkm)} km^2"))
glitt13 commented 5 days ago

@mikejohnson51 The updated hydrofabric v2.2 fixed the aforementioned issue with that specific comid 6716129 in v2.1.1. I ran through 600 comids and the following issues arose: comid 18075806 missing attribute data comid 23844955 missing attribute data comid 20437386 basin area totals 7409.32km^2 but divide-attributes only cover 7389.91km^2 comid 23864616 missing attribute data comid 7842827 missing attribute data comid 8315607 basin area totals 46.3km^2 but divide-attributes only cover 11.21km^2 comid 8523325 basin area totals 396.09km^2, but divide-attributes only cover 339.09km^2 comid 8746117 missing attribute data