Sunday, September 25, 2016

Week 3 Assignment

Week 3 assignment.
Further adventures in Martian Craters. To recap - My hypothesis is that Martian craters can be grouped by ejecta type and location (Latitude and Longitude) as well as size and depth. Those groupings may show similarities in the Martian subsurface composition.

To that end, this week I have been re-coding variables to determine groupings and patterns of distribution of these variables. The Martian data set has some variables that are quite granular and so re-coding and binning are necessary to create meaningful groupings.

This weeks SAS code:




/* opens library containing data */
LIBNAME mydata "/courses/d1406ae5ba27fe300 " access=readonly;

/*pulls specific dataset from library */
data new;
                set mydata.marscrater_pds;
               
                /* Group ejecta variable by top layer */
                if index(MORPHOLOGY_EJECTA_1, '/')> 0 then
                                Ejecta_1=substr(MORPHOLOGY_EJECTA_1, 1, index(MORPHOLOGY_EJECTA_1, '/')-1);
                else
                                Ejecta_1=MORPHOLOGY_EJECTA_1;
                /* Recode top layer to roll up types.  */
                Ejecta = compress(substr(upcase(Ejecta_1),1,4));
               
                /* Recode latitude by hemisphere.  */
                if LATITUDE_CIRCLE_IMAGE ge 0 then
                                Lat = 'North';
                else if LATITUDE_CIRCLE_IMAGE lt 0 then
                                Lat = 'South';
                /* Group crater distribution by quadrant. */                          
                if LONGITUDE_CIRCLE_IMAGE ge 0 and LONGITUDE_CIRCLE_IMAGE le 90  then
                                Long = 'NearW';
                else if LONGITUDE_CIRCLE_IMAGE gt 90 and LONGITUDE_CIRCLE_IMAGE le 180  then
                                Long = 'FarW ';
                else if LONGITUDE_CIRCLE_IMAGE lt 0 and LONGITUDE_CIRCLE_IMAGE ge -90 then
                                Long = 'NearE';
                else if LONGITUDE_CIRCLE_IMAGE lt -90 /*and LONGITUDE_CIRCLE_IMAGE ge -180*/ then
                                Long = 'FarE ';
                /* Recode latitude and longitude groups into new variable. */              
                Lat_Long = Cat(Lat,'/',Long);                    
               
                /* Recode diameter to group variables. */             
                if DIAM_CIRCLE_IMAGE >= 0 and DIAM_CIRCLE_IMAGE le 3 then
                                diameter = 'a. 0-3km  ';
                else if DIAM_CIRCLE_IMAGE > 3 and DIAM_CIRCLE_IMAGE le 4 then
                                diameter = 'b. 3-4km  ';
                else if DIAM_CIRCLE_IMAGE > 4 and DIAM_CIRCLE_IMAGE le 6 then
                                diameter = 'c. 4-6km  ';           
                else if DIAM_CIRCLE_IMAGE > 6 and DIAM_CIRCLE_IMAGE le 10 then
                                diameter = 'd. 6-10km  ';         
                else if DIAM_CIRCLE_IMAGE > 10 and diameter_1 le 50 then
                                diameter = 'e. 10-50km';         

                /* Recode depth to group variables. */
                if DEPTH_RIMFLOOR_TOPOG <= .1 then
                                Depth = 'a. 0 to .1km  ';
                else if DEPTH_RIMFLOOR_TOPOG >.1 and DEPTH_RIMFLOOR_TOPOG <= .35 then
                                Depth = 'b. .1 to .35km';
                else if DEPTH_RIMFLOOR_TOPOG >.35 and DEPTH_RIMFLOOR_TOPOG <= .6 then
                                Depth = 'c. .35 to .6km';
                else if DEPTH_RIMFLOOR_TOPOG > .6 then
                                Depth = 'f. > .6km     ';
               
                /* Create labels for frequency result tables */
                label Ejecta = "Ejecta Group"
                                  Lat_Long = "Quadrant"
                                  Diameter = "Crater Diameter"
                                  Depth = "Crater Depth";

                /* Limit to craters 50 km or less in diameter. */
                if diam_circle_image le 50;
                /*Limit to craters described by MORPHOLOGY_EJECTA_1 variable. */
                if morphology_ejecta_1 ne ' ';

proc sort ;
                by crater_id;
/*Perform frequency distribution ordered by frequency*/     
Proc freq order=freq;
                tables Ejecta;
run;
/* Perform frequency distribution ordered by variable values */           
Proc freq /*order=data*/;
                tables  Lat_Long Diameter Depth ;         
run;


The results:

Ejecta types for the top layer were reduced to 4 characters to roll them into more cohesive groups and still the RD types is most prevalent at 60.07 %. To try for meaningful groupings for non RD ejecta types, I may have to change the way they are identified in the entire Morphology_Ejecta_1 variable.
 

Latitude and Longitude were re coded by northern and southern hemisphere latitude as well as four quadrants for longitude. These variables were then combined to create a Lat_Long variable that placed each crater in one of these areas. The lowest crater densities are found in the Far East and Far West of the Northern hemisphere with the strongest concentrations overall in the Southern hemisphere.(Almost 58%)
 


The crater diameter variable was re coded into ranges attempting to get the most even distribution between whole number diameters. The lightest concentration of ejecta craters occurs in the 0-3 km range at 6.85% while 59.60% of all ejecta craters are 6km in diameter or less.
 

Crater depth was likewise re coded into ranges and also converted to meters. 75.07% of all ejecta craters are 600 meters or less in depth. For current purposes the ranges were chosen to give an even distribution between the ranges and I expect once depth is related to other variables, different ranges my be used.
 


No comments: