Author: Nicholas R. Wheeler, Chelsey Bryant, Franz Rubel, Roger H. French
Date: 2017-09-21

# KGC Data Resolution Example

#### Nicholas R. Wheeler, Chelsey Bryant, Franz Rubel, Roger H. French

#### 2017-09-21

Two differing resolutions of climate zone data have been included in this package.

These can be accessed with the parameter `res` in the `RoundCoordinates()` and `LookupCZ()` functions.

## Resolution Details

- Course Resolution

  - Distance between data points, both latitude and longitude, is 0.5 degrees.

  - Latitude and longitude values are rounded to the nearest value ending in either 0.25 and 0.75.

- Fine Resolution

  - Distance between data points, in both latitude and longitude, is 100 seconds.

  - Data originates from a 12960 x 6480 pixel image, and coordinates are rounded to the center coordinates of the nearest pixel.

## Example

- An selection of example cities worldwide, and their reported climate zones from Wikipedia, have been included in this package in the dataframe `kgcities`.

- Estimated climate zones for each city from both course and fine resolution datasets are queried, and results are shown in tabular format.

    library("kgc")
    print(head(kgcities))

    ##                  loc                rczd rcz       lon         lat
    ## 1      Puyo, Ecuador tropical rainforest  Af -78.00111 -1.06666700
    ## 2   Medan, Indonesia tropical rainforest  Af  98.66667  3.58333300
    ## 3 Davao, Philippines tropical rainforest  Af 125.60000  7.06666700
    ## 4     Macapa, Brazil    tropical monsoon  Am -51.06639  0.03388889
    ## 5     Miami, Florida    tropical monsoon  Am -80.20889 25.77528000
    ## 6    Yangon, Myanmar    tropical monsoon  Am  96.18333 16.85000000

      # Query Course Resolution
      data <- data.frame(kgcities, rndCoord.lon = RoundCoordinates(kgcities$lon), rndCoord.lat = RoundCoordinates(kgcities$lat))
      data <- data.frame(data,CZ.c=LookupCZ(data))
      colnames(data)[which(colnames(data)=='rndCoord.lon')] <- 'rndCoord.lon.course'
      colnames(data)[which(colnames(data)=='rndCoord.lat')] <- 'rndCoord.lat.course'

      # Query Fine Resolution
      data <- data.frame(data, rndCoord.lon = RoundCoordinates(kgcities$lon,res='fine',latlong='lon'), rndCoord.lat = RoundCoordinates(kgcities$lat,res='fine',latlong='lat'))
      data <- data.frame(data,CZ.f=LookupCZ(data,res='fine'))

      # Print Results
      print(data[,c(1,3,8,11)])

    ##                                 loc rcz CZ.c  CZ.f
    ## 1                     Puyo, Ecuador  Af  Cfb    Af
    ## 2                  Medan, Indonesia  Af   Af    Af
    ## 3                Davao, Philippines  Af   Af    Af
    ## 4                    Macapa, Brazil  Am   Am    Am
    ## 5                    Miami, Florida  Am   Am    Am
    ## 6                   Yangon, Myanmar  Am   Am    Am
    ## 7  Monte Cristi, Dominican Republic  As   Aw    Aw
    ## 8            Trincomalee, Sri Lanka  As   As    As
    ## 9       Luperon, Dominican Republic  As   Af    Af
    ## 10                Darwin, Australia  Aw   Aw    Aw
    ## 11                 Brasilia, Brazil  Aw   Aw    Aw
    ## 12                     Accra, Ghana  Aw   Aw    Aw
    ## 13                     Sabha, Libya BWh  BWh   BWh
    ## 14                    Murcia, Spain BWh  BSk   BSk
    ## 15                       Lima, Peru BWn   Af    Af
    ## 16                    Niamey, Niger BSh  BSh   BSh
    ## 17                  Alicante, Spain BSh  BSk   BSh
    ## 18                  Piraeus, Greece BSh  Csa   Csa
    ## 19              Swakopmund, Namibia BWn  BWk   BWh
    ## 20              Walvis Bay, Namibia BWn  BWk   BWh
    ## 21                       Lima, Peru BWn  BWh   BWh
    ## 22                       Leh, India BWk  Dwc   BWk
    ## 23                Aktau, Kazakhstan BWk  BSk   BWk
    ## 24                Nukus, Uzbekistan BWk  BWk   BWk
    ## 25                     Reno, Nevada BSk  Csb   Csa
    ## 26                     Tabriz, Iran BSk  BSk   BSk
    ## 27                  Zaragoza, Spain BSk  BSk   BSk
    ## 28                  Beirut, Lebanon Csa  Csa   Csa
    ## 29              Adelaide, Australia Csa  Csb   Csb
    ## 30                     Nice, France Csa  Csb   Csa
    ## 31                  Porto, Portugal Csb  Csb   Csb
    ## 32          Cape Town, South Africa Csb  Csb   Csb
    ## 33                   Potenza, Italy Csb  Csb   Cfb
    ## 34                 Balmaceda, Chile Csc  Cfc   Csb
    ## 35    Haleakala Summit, Hawaii, USA Csc   Af Ocean
    ## 36                        New Delhi Cwa  Cwa   BSh
    ## 37                   Hanoi, Vietnam Cwa  Cwa   Cwa
    ## 38                 Kathmandu, Nepal Cwa  Cwa   Cwa
    ## 39                  Da Lat, Vietnam Cwb   Aw   Cwb
    ## 40                   Nairobi, Kenya Cwb  Cfb   Cfb
    ## 41              Mexico City, Mexico Cwb  Cwb   Cwb
    ## 42                 El Alto, Bolivia Cwc  Cwc    ET
    ## 43             Durban, South Africa Cfa  Cfa   Cfa
    ## 44                     Tokyo, Japan Cfa  Cfa   Cfa
    ## 45                 Kutaisi, Georgia Cfa  Cfa   Cfa
    ## 46                    Paris, France Cfb  Cfb   Cfb
    ## 47                  Berlin, Germany Cfb  Cfb   Cfb
    ## 48     Port Elizabeth, South Africa Cfb  Cfa   BSh
    ## 49            Unalaska, Alaska, USA Cfc   ET   Cfc
    ## 50               Reykjavík, Iceland Cfc  Cfc   Cfc
    ## 51              Punta Arenas, Chile Cfc   ET   Cfc
    ## 52              Bishkek, Kyrgyzstan Dsa  Dfb   Dfa
    ## 53                      Mus, Turkey Dsa  Dsa   Dsb
    ## 54            Cambridge, Idaho, USA Dsa  Csb   Csa
    ## 55                    Sivas, Turkey Dsb  Dsb   Dsb
    ## 56           Bridgeport, California Dsb  Csb   Csb
    ## 57                      Dras, India Dsb  Dfc   Dfc
    ## 58               Homer, Alaska, USA Dsc  Dfc   Dsc
    ## 59           Bodie, California, USA Dsc  Csb   Csb
    ## 60    Bohemia Mountain, Oregon, USA Dsc  Csb   Csb
    ## 61                   Beijing, China Dwa  Dwa   BSk
    ## 62                 Changchun, China Dwa  Dwa   Dwa
    ## 63           Pyongyang, North Korea Dwa  Dwa   Dwa
    ## 64              Vladivostok, Russia Dwb  Dwb   Dwb
    ## 65           Baruunturuun, Mongolia Dwb  BSk   BSk
    ## 66                     Heihe, China Dwb  Dwb   Dwb
    ## 67        Yushu City, Qinghai China Dwc   ET    ET
    ## 68                  Moron, Mongolia Dwc  Dwc   BSk
    ## 69                     Lukla, Nepal Dwc   ET   Cwb
    ## 70                 Seymchan, Russia Dwd  Dfc   Dfc
    ## 71                 Oymyakon, Russia Dwd  Dfd   Dfd
    ## 72                 Oral, Kazakhstan Dfa  Dfa   Dfa
    ## 73      Minneapolis, Minnesota, USA Dfa  Dfa   Dfa
    ## 74               Bucharest, Romania Dfa  Cfa   Cfa
    ## 75         Montpelier, Vermont, USA Dfb  Dfb   Dfb
    ## 76            Youngstown, Ohio, USA Dfb  Dfb   Cfb
    ## 77                  Erzurum, Turkey Dfb  Dfb   Dsb
    ## 78                    Aldan, Russia Dfc  Dfc   Dfc
    ## 79           Anchorage, Alaska, USA Dfc  Dfc   Dsc
    ## 80                   Tromso, Norway Dfc  Dfc   Dfc
    ## 81                  Yakutsk, Russia Dfd  Dfd   Dfc
    ## 82              Verkhoyansk, Russia Dfd  Dfd   Dfd
    ## 83               Ushuaia, Argentina  ET   ET    ET
    ## 84               La Rinconada, Peru  ET   ET    ET
    ## 85      Mt Rainier, Washington, USA  ET  Csb    ET
    ## 86             Mount Ararat, Turkey  EF  Csa Ocean
    ## 87       Mount Everest, China/Nepal  EF   ET    EF
    ## 88           Scott Base, Antarctica  EF   EF    EF