[ncl-talk] About shapefiles

Mary Haley haley at ucar.edu
Mon Jul 11 09:32:02 MDT 2016


Soares,

I will help you one more time on this problem. You need to read and
understand the emails and scripts I've sent you, rather then just emailing
me for more help. You must LOOK AT YOUR DATA before you randomly start
adding city names to your "majorCities" list.

I've showed you multiple times how to do this.

I've created an NCL script that reads every string variable off the
TLS_adm2.shp shapefile, and searches for the cities you listed.  I didn't
find any cities called "Cristo Rei" or "Nain Feto" anywhere any of the
shapefiles.  I even searched for just "Nain" and "Feto" and didn't see
anything.

See the attached script, which you can run yourself.

-----------------------------------------------------------------------------------------------------------
I had typed the below before I created the "examine_tls_adm.ncl" script.
This information is potentially useful for future purposes, so I decided to
include it. This explains in more detail how to use "ncl_filedump" and
"grep" on the UNIX command line to examine a file for the cities you want:

For example, if you are trying to find out if there's a city called
"Metinaro" in the "NAME_2" variable, then type this command:

   ncl_filedump -v NAME_2 TLS_adm2.shp | grep "Metinaro"

When I type the above command, I get the following output, which indicates
that this city is indeed in the list:

Metinaro

However, if I try to search  for "Nain Feto":

   ncl_filedump -v NAME_2 TLS_adm2.shp | grep "Nain Feto"

The UNIX prompt comes back without any output. This means it did NOT find
"Nain Feto" in the list.

I then tried:

   ncl_filedump -v NAME_2 TLS_adm2.shp | grep "Nain"
and:

   ncl_filedump -v NAME_2 TLS_adm2.shp | grep "Feto"
These both came back empty, which means you CANNOT use "Nain Feto" in your
"majorCities" variable.

I was then curious about whether there were ANY cities that actually start
with the letter "N", so I did this:

  ncl_filedump -v NAME_2 TLS_adm2.shp | grep "^N"

The "^" is a special character that means to match something that starts
with this letter.  The only city that starts with an "N" is "Nitibe".

I then wanted to see if any part of the NAME_2 cities has an "F" in it:

ncl_filedump -v NAME_2 TLS_adm2.shp | grep "F"

This gave me:

Fatu Fulic
Fatu Mean
Fohorem
Fato Berliu

Hopefully you can see where I'm going with this.  You MUST figure out the
exact name of the cities before you start putting them in your
"majorCities" variable.

--Mary





On Thu, Jun 30, 2016 at 6:19 AM, isakhar sakhar isakhar <
isakhar.inside13 at gmail.com> wrote:

> Dear mother Mary
>
> I still face the error even I change the name of location for the cities
> as below;
>
> majorCities = (/ (/ "Cristo Rei", "Cristo Rei "     /), \
>               (/ "Metinaro",  "Metinaro  "     /), \
>               (/ "Vera Cruz", "Vera Cruz"     /), \
>               (/ "Nain Feto", "Nain Feto"     /), \
>               (/  "Dom Aleixo","Dom Aleixo"/) /)
>
> I also added the printVarSummary but still face the error. I dont exactly
> which variable I should use because I have tried to some variables in line
> 296 but still not working. Sorry for asking alot.
>
> Soares
>
> On Fri, Jun 24, 2016 at 11:58 PM, Mary Haley <haley at ucar.edu> wrote:
>
>> Soares,
>>
>> The problem is simply that are you are trying to look for cities called
>> "Dili" and "Hera" in the TLS_adm2.shp file, but these names don't appear in
>> the NAME_2 variable.
>>
>> This is why Dennis and I were trying to tell you that "print" and
>> "printVarSummary" can be very helpful.
>>
>> If you print the "citiesShapes->NAME_2" variable with:
>>
>> print(citiesShapes->NAME_2)
>>
>> You would see that neither "Dili" or "Hera" are in the file, but "Dili
>> Barat" and "Dili Timur" are.
>>
>> You will need to adjust your code to look for the correct names of the
>> cities.  This is where "ncl_filedump" can help you.
>>
>> You can examine the contents of the TLS_adm2.shp shapefile from the UNIX
>> command line with:
>>
>> ncl_filedump TLS_adm2.shp
>>
>> You will then see the following variables of type "string":
>>
>>       string ISO ( num_features )
>>
>>       string NAME_0 ( num_features )
>>
>>       string NAME_1 ( num_features )
>>
>>       string NAME_2 ( num_features )
>>
>>       string HASC_2 ( num_features )
>>
>>       string CCA_2 ( num_features )
>>
>>       string TYPE_2 ( num_features )
>>
>>       string ENGTYPE_2 ( num_features )
>>
>>       string NL_NAME_2 ( num_features )
>>
>>       string VARNAME_2 ( num_features )
>>
>> You can now examine the contents of each of these variables, also using
>> ncl_filedump:
>>
>> ncl_filedump -v NAME_2 TLS_adm2.shp
>> ncl_filedump -v ENGTYPE_2 TLS_adm2.shp
>> ncl_filedump -v VARNAME_2 TLS_adm2.shp
>> etc.
>>
>> This will help you see which variables on the shapefile might be the most
>> useful to you, and then the exact city name to search for. You can then
>> make this change in your shapefiles_5.ncl script.
>>
>> --Mary
>>
>>
>>
>> On Fri, Jun 24, 2016 at 2:36 AM, isakhar sakhar isakhar <
>> isakhar.inside13 at gmail.com> wrote:
>>
>>> Dear Mrs.Mary
>>>
>>> I could not put my files into ftp server of NCL, so I share it with
>>> dropbox.
>>>
>>>
>>> https://www.dropbox.com/s/iie1snwo2m663dn/soares.tar.gz?dl=0
>>>
>>>
>>> Thank you,
>>> Soares
>>>
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160711/9e7184de/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: examine_tls_adm.ncl
Type: application/octet-stream
Size: 1925 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160711/9e7184de/attachment.obj 


More information about the ncl-talk mailing list