In [35]:
import os as OS
import arcpy as ARCPY
import SSDataObject as SSDO
import SSPanelObject as SSPO
import SSPanel as PANEL
ARCPY.overwriteOutput = True
In [36]:
inputFC = r'../data/CA_Counties_Panel.shp'
outputCube = r'../data/CA_Panel.nc'
fullFC = OS.path.abspath(inputFC)
outputCube = OS.path.abspath(outputCube)
fullPath, fcName = OS.path.split(fullFC)
ssdo = SSDO.SSDataObject(inputFC)
uniqueIDField = "MYID"
timeField = "YEAR"
analysisField = "PCR"
panelObj = SSPO.SSPanelObject(inputFC)
requireGeometry = panelObj.ssdo.shapeType.upper() == "POLYGON"
panelObj.obtainData(uniqueIDField, "YEAR", "1 Years", fields = [analysisField],
requireGeometry = requireGeometry)
panelCube = PANEL.SSPanel(outputCube, panelObj = panelObj)
varName = panelCube.fieldNames[0]
panelCube.mannKendall(varName)
panelCube.close()
In [ ]:
panel = PANEL.SSPanel(outputCube)
In [24]:
print("# locations = {0}, # time periods = {1}".format(panel.numLocations, panel.numTime))
In [26]:
print(panel.obtainVariableList())
In [27]:
import pandas as PANDAS
locations = panel.locationLabel[0]
z = panel.obtainValues('PCR_TREND_ZSCORE')
pv = panel.obtainValues('PCR_TREND_PVALUE')
d = {'PCR_TREND_ZSCORE':z, 'PCR_TREND_PVALUE':pv}
df = PANDAS.DataFrame(d, index = locations)
print(df.head())
In [28]:
data = panel.obtainValues(analysisField)
print(data.shape)
In [31]:
import pysal as PYSAL
w = PYSAL.open(r"../data/queen.gal").read()
lm = PYSAL.LISA_Markov(data.T, w)
print(lm.classes)
In [33]:
print(lm.p)
In [34]:
panel.close()
In [ ]: