npr99 / intersect-community-data

Python functions to obtain and clean data required for the version 2 Housing Unit Allocation. Workflow uses Census API.
18 stars 14 forks source link

output data folders #59

Closed npr99 closed 3 months ago

npr99 commented 3 months ago

code seems to be creating multiple outputdata folders

image

npr99 commented 3 months ago

found issue where code sometimes uses the community label and other times uses county

npr99 commented 3 months ago

def setup_directory():

Define output directories

output_sourcedata = os.path.join('Outputdata', '00_SourceData')
output_directory = os.path.join(output_sourcedata, 'nces_ed_gov')
unzipped_output_directory = os.path.join(output_directory, 'unzipped')

# Create output directory if it does not exist
def create_directory(path):
    if not os.path.exists(path):
        print(f"Making new directory to save output: {path}")
        os.makedirs(path)
    else:
        print(f"Directory {path} already exists.")

create_directory(output_sourcedata)
create_directory(output_directory)
create_directory(unzipped_output_directory)

return output_directory, unzipped_output_directory
npr99 commented 3 months ago

replace def setup_nsi_directory():

Create output directory if it does not exist

output_folder = 'Outputdata'
output_sourcedata = 'Outputdata\\00_SourceData'
output_directory = 'Outputdata\\00_SourceData\\nsi_sec_usace_army_mil'
# Make directory to save output
if not os.path.exists(output_folder):
    print("Making new directory to save output: ",
        output_folder)
    os.mkdir(output_folder)
if not os.path.exists(output_sourcedata):
    print("Making new directory to save output: ",
        output_sourcedata)
    os.mkdir(output_sourcedata)
if not os.path.exists(output_directory):
    print("Making new directory to save output: ",
        output_directory)
    os.mkdir(output_directory)
else:
    print("Directory",output_directory,"Already exists.")

return output_directory
npr99 commented 3 months ago

notice I had Outputdata not in camelcase OutputData

npr99 commented 3 months ago

I think I just realized - the issue is that codespace is Linux and my code is designed to run on Windows