Skip to content

Commit

Permalink
correct write_geotiff import, typo fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jsta committed Mar 13, 2024
1 parent 48c4a61 commit b3f047d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
10 changes: 7 additions & 3 deletions hydropop/dev/end_to_end_new.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import sys
import rabpro
import argparse
import pandas as pd
from osgeo import gdal
import geopandas as gpd
Expand Down Expand Up @@ -69,15 +70,15 @@
# Compute areagrid required for computing HP unit areas
agrid = hut.areagrid(paths['hpu_raster'])
gdobj = gdal.Open(paths['hpu_raster'])
wg(agrid, gdobj.GetGeoTransform(), gdobj.GetProjection(), paths['areagrid'], dtype=gdal.GDT_Float32)
wg.write_geotiff(agrid, gdobj.GetGeoTransform(), gdobj.GetProjection(), paths['areagrid'], dtype=gdal.GDT_Float32)

""" Compute statistics for HPUs """
# First, we do zonal stats on the locally-available rasters
# HPU stats and properties
do_stats = {'hthi' : [path_hthi, ['mean']],
'pop' : [path_pop, ['mean']],
'area' : [paths['areagrid'], ['sum'], path_hpu_raster],
'hpu_class' :[paths['hpu_class_simplfied'], ['majority']]}
'area' : [paths['areagrid'], ['sum']],
'hpu_class' :[paths['hpu_class_raster'], ['majority']]}
hpugen.compute_hpu_stats(do_stats)
# Export the geopackage that contains all the HPU attributes
hpugen.hpus.to_file(paths['hpu_gpkg'], driver='GPKG')
Expand All @@ -87,6 +88,9 @@
hpus_shp.to_file(paths['hpu_shapefile']) # shapefile needed to upload to GEE

""" STOP. Here you need to upload the hpu shapefile as a GEE asset. """
is_uploaded_to_gee = input("Next step, upload the following shapefile (and its components) to GEE (Y/n)")
while is_uploaded_to_gee is "n":
is_uploaded_to_gee = input("Next step, upload the following shapefile (and its components) to GEE (Y/n)")

""" Update the gee_asset variable. """
datasets, Datasets = gee.generate_datasets()
Expand Down
8 changes: 1 addition & 7 deletions hydropop/gee_stats.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 4 11:44:11 2022
@author: 318596
"""
import os
os.environ['RABPRO_DATA'] = r'X:\Data'
import pandas as pd
Expand Down Expand Up @@ -67,7 +61,7 @@ def generate_datasets(dslist=None):
Returns a list of rabpro.Dataset objects that can be passed to
rabpro.subbasin_stats.compute(). These datasets will be sampled over
each HPU, and this particluar set was chosen in order to provide
HPU-specific parameterizations for the E3SM's Land Model.
HPU-specific parameterizations for the E3SM Land Model.
"""
# Create rabpro Dataset list -- uses a dictionary so parsing the results is easier
dataset_dict = {
Expand Down

0 comments on commit b3f047d

Please sign in to comment.