Hello guys!
I have a few questions with regards to collapsing grid level data set into district level and also the geodist fuction. The datasets consist of daily rainfall and temperature grid point data from 2009-2013, which ive merged and cleaned into two separate files that look like this (using rainfall as an example, long dataset):
latitude longitude rainfall year month day temperature edate
10.5 76.5 0 2009 1 1 01jan2009
10.5 77.5 0 2009 1 1 01jan2009
10.5 78.5 0 2009 1 1 01jan2009
10.5 79.5 0 2009 1 1 01jan2009
11.5 75.5 0 2009 1 1 01jan2009
11.5 76.5 0 2009 1 1 01jan2009
11.5 77.5 0 2009 1 1 01jan2009
11.5 78.5 0 2009 1 1 01jan2009
11.5 79.5 0 2009 1 1 01jan2009
12.5 75.5 0 2009 1 1 01jan2009
And the spatial data looks like this (at the moment) - there are 5 states and 76 districs
stname_iaa dstname_iaa stid_iaa distid_iaa centroid_longitude centroid_latitude unique_dist_id
gujarat ahmedabad 17 11 72.2672 22.7812 1711
gujarat amreli 17 5 71.1778 21.3732 1705
gujarat banaskantha 17 8 71.9399 24.2196 1708
gujarat baroda 17 14 73.5327 22.2301 1714
gujarat bhavnagar 17 4 71.7708 21.5945 1704
gujarat broach 17 15 73.2154 21.7519 1715
gujarat dangs 17 17 73.7177 20.8032 1717
The idea is to to match each grid point to a district according to a weighted average of daily mean temperature, daily mean rainfall, and daily total rainfall for all grid points within 100 KM of each district’s geographic center. The weights are the inverse of the squared distance from the district center.
So I have to use geodist to calculate the distance between the gridpoints and the centroid long/lat given in both bases, that distance will allow me to create the weights, and also drop all variables that are not within 100KM.
Should I first merge the data bases and maybe create a unique id for each district? I am contemplating doing this via the commands collapse but the order of the steps are right now confusing - first geodist? and then collapse? but how the panel will start to take form confuses me a little
Warm regards!
I have a few questions with regards to collapsing grid level data set into district level and also the geodist fuction. The datasets consist of daily rainfall and temperature grid point data from 2009-2013, which ive merged and cleaned into two separate files that look like this (using rainfall as an example, long dataset):
latitude longitude rainfall year month day temperature edate
10.5 76.5 0 2009 1 1 01jan2009
10.5 77.5 0 2009 1 1 01jan2009
10.5 78.5 0 2009 1 1 01jan2009
10.5 79.5 0 2009 1 1 01jan2009
11.5 75.5 0 2009 1 1 01jan2009
11.5 76.5 0 2009 1 1 01jan2009
11.5 77.5 0 2009 1 1 01jan2009
11.5 78.5 0 2009 1 1 01jan2009
11.5 79.5 0 2009 1 1 01jan2009
12.5 75.5 0 2009 1 1 01jan2009
And the spatial data looks like this (at the moment) - there are 5 states and 76 districs
stname_iaa dstname_iaa stid_iaa distid_iaa centroid_longitude centroid_latitude unique_dist_id
gujarat ahmedabad 17 11 72.2672 22.7812 1711
gujarat amreli 17 5 71.1778 21.3732 1705
gujarat banaskantha 17 8 71.9399 24.2196 1708
gujarat baroda 17 14 73.5327 22.2301 1714
gujarat bhavnagar 17 4 71.7708 21.5945 1704
gujarat broach 17 15 73.2154 21.7519 1715
gujarat dangs 17 17 73.7177 20.8032 1717
The idea is to to match each grid point to a district according to a weighted average of daily mean temperature, daily mean rainfall, and daily total rainfall for all grid points within 100 KM of each district’s geographic center. The weights are the inverse of the squared distance from the district center.
So I have to use geodist to calculate the distance between the gridpoints and the centroid long/lat given in both bases, that distance will allow me to create the weights, and also drop all variables that are not within 100KM.
Should I first merge the data bases and maybe create a unique id for each district? I am contemplating doing this via the commands collapse but the order of the steps are right now confusing - first geodist? and then collapse? but how the panel will start to take form confuses me a little
Warm regards!