# -*- coding: UTF-8 -*- # File: Environment_points # Time: 7/28/2016 -> 5:58 PM from arcgis_function.csv_to_shp import make_event_layer import os AOT_SUBDIR = os.path.normcase("G:\Environment") AOTS = ["stations.csv"] input_csvs = [os.path.join(AOT_SUBDIR, aot) for aot in AOTS] out_subdir = os.path.normcase("G:\Environment\Environment_spatial") in_mask = os.path.normcase("D:/Dian/Spatial_Files/United_States_2000/background/newstates.shp") for input_csv in input_csvs: out_shp = os.path.join(out_subdir, os.path.basename(input_csv)[:-4] + ".shp") make_event_layer(input_csv, out_shp)
from arcgis_function.Idw import idw from arcgis_function.csv_to_shp import make_event_layer import arcpy import os AOT_SUBDIR = os.path.normcase("D:\Ozone_data_process\ozone_norm_sta") AOTS = ["ozone_raw_2012.csv"] input_csvs = [os.path.join(AOT_SUBDIR, aot) for aot in AOTS] out_subdir = os.path.normcase("D:\Ozone_data_process\ozone_spatial") in_mask = os.path.normcase( "D:/Dian/Spatial_Files/United_States_2000/background/newstates.shp") for input_csv in input_csvs: out_shp = os.path.join(out_subdir, os.path.basename(input_csv)[:-4] + ".shp") make_event_layer(input_csv, out_shp) aot_shp = os.path.join(os.path.dirname(out_shp), "AOT49.shp") annual_shp = os.path.join(os.path.dirname(out_shp), "Ymean.shp") arcpy.Select_analysis(out_shp, aot_shp, 'Aot4_9 > 0') arcpy.Select_analysis(out_shp, annual_shp, 'Year_mean > 0') idw(aot_shp, "Aot4_9", os.path.join(out_subdir, "Aotidw"), in_mask) idw(annual_shp, "Year_mean", os.path.join(out_subdir, "Yearidw"), in_mask)
from arcgis_function.Idw import idw from arcgis_function.csv_to_shp import make_event_layer from arcgis_function.extract_by_mask import extract_by_mask import os import glob AOT_SUBDIR = os.path.normcase("D:\Dian\Data\Ozone") years = range(1990, 2015) AOTS = ["aot49_" + str(year) + ".csv" for year in years] input_csvs = [os.path.join(AOT_SUBDIR, aot) for aot in AOTS] out_subdir = os.path.normcase("D:\Dian\Spatial_Image\Ozone49") in_mask = os.path.normcase( "D:/Dian/Data/United_States_2000/background/newstates.shp") for input_csv in input_csvs: make_event_layer(input_csv, out_subdir, os.path.basename(input_csv)[:-4]) input_features = glob.glob(os.path.join(out_subdir, "*.shp")) for input_feature in input_features: idw(input_feature, "mozone", input_feature[:-4], in_mask)
import os from arcgis_function.csv_to_shp import make_event_layer from arcgis_function.add_location_URC import loc_urc import arcpy arcpy.env.overwriteOutput = True sitelist_path = "G:\yang\ozone_process/ozone_data/ozone_points_all.csv" clean_path = "D:\Dian\Data/2012/Castnetsites.csv" output_subdir = "G:\yang\ozone_process/ozone_data/" sitelist_shp = os.path.join(output_subdir, os.path.basename(sitelist_path)[:-4] + ".shp") clean_shp = os.path.join(output_subdir, os.path.basename(clean_path)[:-4] + ".shp") make_event_layer(sitelist_path, sitelist_shp) make_event_layer(clean_path, clean_shp) urban_polygon = "D:\Dian\Spatial_Files\United_States_2010/Urban_area_2010.shp" loc_urc(sitelist_shp, urban_polygon, cast_sites=clean_shp, out_features=os.path.join(output_subdir, "sitelist_urc.shp"))
from arcgis_function.csv_to_shp import make_event_layer from arcgis_function.extract_by_mask import extract_by_mask import os import glob AOT_SUBDIR = os.path.normcase("D:\Dian\Data\Ozone") years = range(1990, 2015) AOTS = ["aot49_" + str(year) + ".csv" for year in years] input_csvs = [os.path.join(AOT_SUBDIR, aot) for aot in AOTS] out_subdir = os.path.normcase("D:\Dian\Spatial_Image\Ozone49") in_mask = os.path.normcase("D:/Dian/Data/United_States_2000/background/newstates.shp") for input_csv in input_csvs: make_event_layer(input_csv, out_subdir, os.path.basename(input_csv)[:-4]) input_features = glob.glob(os.path.join(out_subdir, "*.shp")) for input_feature in input_features: idw(input_feature, "mozone", input_feature[:-4], in_mask)
# -*- coding: UTF-8 -*- # File: Environment_csv_to_shp # Time: 8/1/2016 -> 11:06 AM import os from arcgis_function.csv_to_shp import make_event_layer import arcpy Temp_subdir = os.path.normcase("G:\Environment\Temp") Temp = "temp_points.csv" out_subdir = os.path.normcase("G:\Environment\Environment_spatial") Prcp_subdir = os.path.normcase("G:\Environment\Prcp") Prcp = "prcp_points.csv" Temp_csv = os.path.join(Temp_subdir, Temp) Temp_shp = os.path.join(out_subdir, Temp[:-4] + ".shp") make_event_layer(Temp_csv, Temp_shp) Prcp_csv = os.path.join(Prcp_subdir, Prcp) Prcp_shp = os.path.join(out_subdir, Prcp[:-4] + ".shp") make_event_layer(Prcp_csv, Prcp_shp) target_shp = os.path.join(out_subdir, "ozone_points.shp") ozone_temp = os.path.join(out_subdir,"ozone_temp_join.shp") # arcpy.Select_analysis(out_shp, aot_shp, 'Aot4_9 > 0')
import arcpy arcpy.env.overwriteOutput = True URAN_PATH = os.path.normcase("D:\Dian\Data\United_States_2010") URBAN_NAMES = ["Urban_area_1990.shp", "Urban_area_2000.shp", "Urban_area_2010.shp"] SITELIST_SUBDIR = os.path.normcase("D:\Dian\Data\Ozone") SITELIST_NAMES = ["sitelist_9099.csv", "sitelist_0009.csv", "sitelist_1014.csv"] site_files = [os.path.join(SITELIST_SUBDIR, item) for item in SITELIST_NAMES] output_subdir = "D:\Dian\Data\United_States_2010\sites_shp_of_3per/" for site_file in site_files: out_file = os.path.join(output_subdir, os.path.basename(site_file)[:-4]+".shp") make_event_layer(site_file, out_file) for site_name, urban_name in zip(SITELIST_NAMES, URBAN_NAMES): total_site = os.path.join(output_subdir, site_name[:-4] + '.shp') urban_polygon = os.path.join(URAN_PATH, urban_name) year_range = site_name[-8:-4] output_features = os.path.join(output_subdir, "site_ur_" + year_range + ".shp") loc_ur(total_site, urban_polygon, output_features) csv_files = glob.glob(os.path.join(output_subdir, "*.csv")) for csv_file in csv_files: add_field_by_others(csv_file, "region", "statecode", map_func=statecode_to_region)
URBAN_NAMES = [ "Urban_area_1990.shp", "Urban_area_2000.shp", "Urban_area_2010.shp" ] SITELIST_SUBDIR = os.path.normcase("D:\Dian\Data\Ozone") SITELIST_NAMES = [ "sitelist_9099.csv", "sitelist_0009.csv", "sitelist_1014.csv" ] site_files = [os.path.join(SITELIST_SUBDIR, item) for item in SITELIST_NAMES] output_subdir = "D:\Dian\Data\United_States_2010\sites_shp_of_3per/" for site_file in site_files: out_file = os.path.join(output_subdir, os.path.basename(site_file)[:-4] + ".shp") make_event_layer(site_file, out_file) for site_name, urban_name in zip(SITELIST_NAMES, URBAN_NAMES): total_site = os.path.join(output_subdir, site_name[:-4] + '.shp') urban_polygon = os.path.join(URAN_PATH, urban_name) year_range = site_name[-8:-4] output_features = os.path.join(output_subdir, "site_ur_" + year_range + ".shp") loc_ur(total_site, urban_polygon, output_features) csv_files = glob.glob(os.path.join(output_subdir, "*.csv")) for csv_file in csv_files: add_field_by_others(csv_file, "region", "statecode", map_func=statecode_to_region)
from arcgis_function import csv_to_shp from arcgis_function.csv_to_shp import make_event_layer from arcgis_function.csv_to_shp import make_event_layer as make csv_to_shp.make_event_layer(in_table='dfdjfl', base_name='dfdlfjld', 'dfdklfdjl') make_event_layer((dfljdlfjdlfj)) make(dfldjfldjfld)