USGS-R / drb-gw-hw-model-prep

Code repo to prepare groundwater and headwater-related datasets for modeling river temperature in the Delaware River Basin
Other
0 stars 3 forks source link

Fetch statsgo #4

Closed msleckman closed 2 years ago

msleckman commented 2 years ago

This PR is ready for review.

Added 3 targets: p1_selected_statsgo_sbid_children: Pulls the specific child items from the Statsgo soil characteristics data release from Science base. Only interested in Texture attributes and Soil Layer attributes. (intermediate target) p1_download_statsgo_text_layer_attr: file target downloading the statsgo zip files (intermediate target) p1_statsgo_soil_df: reads in and scopes statsgo dataset + cbinds so that we have 1 target df object with total upstream (TOT), accumulated (ACC), and catchment (CAT)-level values. (final fetch target)

Added 1 function: sb_read_filter_by_comids() outputs p1_statsgo_soil_df. Built for statsgo but generalizable to any comid-level sb dataset that requires fetching and initial scoping (col selection and aoi row filtering).

p1_statsgo_soil_df output:

   COMID ACC_KFACT ACC_KFACT_UP ACC_NO10AVE ACC_NO4AVE ACC_WTDEP CAT_KFACT CAT_KFACT_UP CAT_NO10AVE CAT_NO4AVE CAT_WTDEP TOT_KFACT TOT_KFACT_UP TOT_NO10AVE
1 1748535      0.28         0.24       49.80      57.25      4.89      0.28         0.24       49.80      57.25      4.89      0.28         0.24       49.80
2 1748537      0.28         0.24       51.47      58.49      4.41      0.28         0.24       51.47      58.49      4.41      0.28         0.24       51.47
3 1748539      0.28         0.24       52.71      59.68      3.77      0.28         0.24       52.71      59.68      3.77      0.28         0.24       52.71
4 1748541      0.28         0.24       50.21      57.61      4.80      0.28         0.24       49.75      57.43      5.00      0.28         0.24       50.21
5 1748543      0.28         0.24       51.60      58.85      4.23      0.28         0.24       49.04      56.92      5.29      0.28         0.24       51.60
6 1748545      0.28         0.25       49.03      56.91      5.29      0.28         0.25       49.03      56.91      5.29      0.28         0.25       49.03
  TOT_NO4AVE TOT_WTDEP ACC_SILTAVE ACC_CLAYAVE ACC_SANDAVE CAT_SILTAVE CAT_CLAYAVE CAT_SANDAVE TOT_SILTAVE TOT_CLAYAVE TOT_SANDAVE
1      57.25      4.89       59.74       14.56       25.70       59.74       14.56       25.70       59.74       14.56       25.70
2      58.49      4.41       59.52       13.75       26.73       59.52       13.75       26.73       59.52       13.75       26.73
3      59.68      3.77       58.99       13.47       27.53       58.99       13.47       27.53       58.99       13.47       27.53
4      57.61      4.80       59.72       14.43       25.84       59.90       14.89       25.21       59.72       14.43       25.84
5      58.85      4.23       59.33       14.02       26.65       60.09       15.28       24.63       59.33       14.02       26.65
6      56.91      5.29       60.09       15.28       24.62       60.09       15.28       24.62       60.09       15.28       24.62

Notes of p1_statsgo_soil_df target:

msleckman commented 2 years ago

@lekoenig Changes incorporated and ready for merge.

msleckman commented 2 years ago

merge conflict resolved. After incorporating the latest changes from USGS-R/main there's an issue with the manual download of study_monitoring_sites.zip (1_fetch.R:L46). OK to merge, trouble shooting will take place in #10.

msleckman commented 2 years ago

Pipeline runs successfully for me with latest merge from main.

image