Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Drawing the Tunisia map for a climate indicator

    Hello Stata users;

    I have two datasets at hand.
    The first one is the following:

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input byte _ID double(_X _Y)
    1                  .                  .
    1 10.294043948000024  36.81223798600007
    1 10.293853074000026 36.812280315000066
    1 10.293523743000037  36.81227622100005
    1 10.292941361000032 36.812275243000045
    1 10.291989809000029  36.81239747500007
    1 10.291467179000051  36.81250237300003
    1 10.291416769000023  36.81250995900007
    1  10.29129204700007  36.81252724900003
    1 10.290580902000045  36.81261987400006
    1  10.29010450100003  36.81267135100006
    1 10.289003717000071 36.812777324000024
    1 10.288439001000029  36.81279873400007
    1 10.288342025000077  36.81280359100003
    1 10.288092568000025  36.81279938600005
    1 10.287606793000066  36.81278840600004
    1 10.287479320000045  36.81278928000006
    1  10.28697081000007  36.81272506600004
    1  10.28120788900003 36.812142453000035
    1 10.275976373000049  36.81137118300006
    1 10.271251771000038 36.810566633000064
    1 10.270679608000023  36.81046923400004
    1 10.267792907000057 36.809984815000064
    1  10.26418764500005  36.80939742100003
    1  10.25997111700002 36.808723573000066
    1 10.259223732000066 36.808604107000065
    1 10.253966673000036  36.80772215500008
    1 10.248317228000076  36.80679941500006
    1 10.247214151000037  36.80661568200003
    1 10.242772999000067  36.80587583200003
    1 10.237071230000026  36.80494173200003
    1 10.231488214000024  36.80405999200008
    1 10.225852823000025  36.80318827600007
    1 10.223902764000059  36.80287677200005
    1 10.221989929000074  36.80027086400003
    1 10.219960483000023  36.79751609700003
    1 10.218108014000052 36.795012083000074
    1  10.21639988100003  36.79268521300003
    1 10.215941460000067 36.792060710000044
    1 10.214117399000031 36.789589514000056
    1 10.212197588000038 36.786965302000056
    1 10.210017514000072  36.78402483600007
    1 10.207811434000064  36.78101876200003
    1 10.205803346000039  36.77855258300008
    1  10.20706038700007  36.77775443200005
    1 10.208221910000077  36.77736210300003
    1 10.209596721000025 36.776963684000066
    1 10.209673390000034  36.77687109800007
    1 10.210484501000053  36.77549387000005
    1 10.210439617000077  36.77547792800004
    1  10.21115876600004  36.77422768500003
    1 10.211931745000072  36.77285008500007
    1 10.211953953000034 36.772821613000076
    1 10.211971550000044  36.77280022900004
    1 10.211994262000076 36.772773717000064
    1 10.212022382000043  36.77274247200006
    1 10.212049113000035  36.77271424500003
    1 10.212077535000049 36.772685384000056
    1 10.212107009000022  36.77265692900005
    1 10.212130731000059  36.77263510800003
    1  10.21215213000005 36.772616087000074
    1 10.212176789000068  36.77259499200005
    1 10.212201917000073 36.772574364000036
    1 10.212227046000066  36.77255401800005
    1 10.212250503000064  36.77253615600006
    1 10.212276965000058  36.77251649600004
    1 10.212303850000069  36.77249725900003
    1 10.212334299000076 36.772476450000056
    1 10.213169956000058  36.77211357400006
    1 10.213828306000039  36.77183353700008
    1 10.214528519000055  36.77146650900005
    1 10.214693991000047 36.771382946000074
    1 10.214783005000072  36.77132305200007
    1 10.214808833000063 36.771302598000034
    1 10.214839105000067  36.77127713400006
    1 10.214863791000028 36.771256050000034
    1  10.21488524800003 36.771237050000025
    1 10.214906528000029  36.77121770100007
    1 10.214927458000034  36.77119828100007
    1 10.214947863000077 36.771178580000026
    1 10.214973147000023  36.77115363300004
    1 10.215006096000025  36.77111941700008
    1 10.215038606000064  36.77108461700004
    1 10.215059950000068  36.77105956100007
    1 10.215086775000032  36.77102567700007
    1 10.215109277000067  36.77099704200003
    1 10.215129615000023  36.77096949700007
    1 10.215154889000075 36.770934812000064
    1 10.215175574000057  36.77090532300008
    1 10.215192804000026  36.77087992700007
    1 10.215218210000046  36.77084172900004
    1 10.215244478000045 36.770800148000035
    1 10.215265696000074  36.77076551700003
    1 10.215284543000053  36.77073349600005
    1 10.215302669000039  36.77070138500005
    1 10.215322017000062  36.77066598400006
    1 10.215337477000048  36.77063632100004
    1 10.215351131000034  36.77060966700003
    1 10.215365018000057 36.770580505000055
    1 10.215379772000063 36.770546085000035
    end
    The second dataset is:
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(Shape_Leng Shape_Area) str12 Governorate_Name byte id0 float(consecutivedrydays1990 consecutivedrydays1991 consecutivedrydays1992)
     1.665691 .04211232 "Ariana"       2  55.416  55.611  55.498
    4.3867736  .3681952 "Beja"         8  52.289  52.549  52.294
    1.7179574 .06661047 "Ben Arous"    3   53.46  53.731   53.59
     5.343521  .3661806 "Bizerte"      7  58.769  58.958  58.732
    4.5108953  .7290807 "Gabes"       19  93.529  94.221  93.679
     4.548769  .7402925 "Gafsa"       22  68.808  69.227  68.703
     3.647018  .3133408 "Jendouba"     9  50.708  50.857  50.494
     4.946872  .6479417 "Kairouan"    16   46.65  47.102   47.06
     4.989357  .8122157 "Kasserine"   17   46.81   47.23  47.263
     7.504424 2.1741836 "Kebili"      24 103.039 103.697 103.211
    4.1811414 .51084507 "Le Kef"      10  44.333  44.519   44.32
     4.073021 .28655812 "Mahdia"      14  62.175  62.514   62.27
    2.2618155  .1153453 "Manouba"      4  51.491  51.685   51.62
     9.757171  .8966198 "Medenine"    20 118.817 119.508 119.378
    2.2377114 .10218735 "Monastir"    13  65.619  65.682  65.316
      3.30774  .2840685 "Nabeul"       5  61.922  62.221  61.896
     7.548694  .6909879 "Sfax"        15  69.883  70.491  70.025
     5.466782  .7327916 "Sidi Bouzid" 18  56.814  57.333   57.26
     5.552421  .4684452 "Siliana"     11  45.615  45.883   45.84
     3.156125  .2278667 "Sousse"      12  53.631  53.848  53.559
    11.073194 3.6204395 "Tataouine"   21 132.807  134000 134.187
     3.798989  .5907553 "Tozeur"      23  87.197  87.781  87.068
    1.6094854 .02651095 "Tunis"        1  54.158   54.43  54.421
    3.2403774 .28479052 "Zaghouan"     6  49.008  49.252  49.196
    end
    This second dataset goes from 1990 to 2085 for the consecutive dry days indicator.

    My goal is to draw the map for that climat indicator for Tunisia, by years (I don't know if I should choose 5 years or 10 years as the step, yet, both suggestions are ok), the goal is to show the cnahe in that climate indicator, by governorate, for each 5 years or 10 years, so the idea is to generate a map for each 5 or 10 years (using an if loop I guess). I also use the spmap for this kind of work, so it will be helpfull if the suggested code uses spmap command.

    Any other suggestions are welcome! Thanks!

  • #2
    I do believe that the code would look something like this:
    qui foreach x of var consecutivedrydays { local z: variable label `x' forvalues year = 1999-2085{ spmap `x' using tngovcoor.dta, id(id0) fcolor(Heat) fcolor(Reds) title("`z'" `year', color(blue)) ysize(8) xsize(14) legt("Legend") legend(pos(1) size(*.95) symx(*.95) symy(*.95) forcesize ) lego(hilo) note(CSA 2018. www.solomonegash.com, pos(7) size(*.95) color(blue) ) local year=string(`year'-1994, "%03.0f") } } I really would love it if I could get some help

    Comment

    Working...
    X