<div dir="ltr"><div dir="ltr">Vanúcia,</div><div dir="ltr"><br></div><div>Shape files come in different varieties.  It looks like example shapefiles_21 may need an upgrade to be able to read your shape file.  If you can send a copy of the shape file, and also your current script shape21.ncl, I will test it on my system.  Please do not include the scientific data file; I do not need it for testing the shape file.  The NCL support team might need to fix this.</div><div><br></div><div>--Dave</div><div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jan 28, 2019 at 9:47 AM Vanúcia Schumacher <<a href="mailto:vanucia-schumacher@hotmail.com">vanucia-schumacher@hotmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">




<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:14pt;color:rgb(0,0,0)">
<span style="font-size:12pt">Thanks for the tip.</span><span><br>
</span><span style="font-size:12pt">I'm trying to use the script from example</span><span style="font-size:12pt">
</span><span><span style="color:rgb(33,33,33);font-size:12pt;background-color:rgb(255,255,255);display:inline">shapefiles_21</span></span><span style="font-size:12pt">,
 b</span><span style="font-size:12pt">ut I'm having this error in function. I can not fix it.</span><br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:14pt;color:rgb(0,0,0)">
<span><br>
</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:14pt;color:rgb(0,0,0)">
<span>
<div style="margin:0px;font-family:Calibri,Helvetica,sans-serif;background-color:rgb(255,255,255)">
<span style="font-size:12pt">fatal:Subscript out of range, error in subscript #0</span><br>
</div>
<div style="margin:0px;font-family:Calibri,Helvetica,sans-serif;background-color:rgb(255,255,255)">
<span style="font-size:12pt">fatal:An error occurred reading features</span><br>
</div>
<div style="margin:0px;font-family:Calibri,Helvetica,sans-serif;background-color:rgb(255,255,255)">
<span style="font-size:12pt">fatal:["Execute.c":8640]:Execute: Error occurred at or near line 56 in file shape21.ncl</span><br>
</div>
<div style="margin:0px;font-family:Calibri,Helvetica,sans-serif;background-color:rgb(255,255,255)">
<br>
</div>
<div style="margin:0px;font-family:Calibri,Helvetica,sans-serif;background-color:rgb(255,255,255)">
<span style="font-size:12pt">fatal:["Execute.c":8640]:Execute: Error occurred at or near line 250 in file shape21.ncl</span><br>
</div>
<br>
<br>
</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:14pt;color:rgb(0,0,0)">
<span style="font-size:12pt">The lines correspond to: </span></div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:14pt;color:rgb(0,0,0)">
<span><br>
</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:14pt;color:rgb(0,0,0)">
<span><br>
</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:14pt;color:rgb(0,0,0)">
<span><span style="font-size:12pt">function get_areas_of_interest(shp_file_name,shp_var_name,opt[1]:logical)</span><span><br>
</span>
<div><span style="font-size:12pt">begin</span><br>
</div>
<div><span style="font-size:12pt">;---Open the shapefile</span><br>
</div>
<div><span style="font-size:12pt">  f = addfile(shp_file_name,"r")</span><br>
</div>
<div><span style="font-size:12pt">  features = f->$shp_var_name$</span><br>
</div>
<div><br>
</div>
<div><span style="font-size:12pt">  if(opt.and.isatt(opt,"areas_to_exclude")) then</span><br>
</div>
<div><span style="font-size:12pt">    features@_FillValue = default_fillvalue(typeof(features))</span><br>
</div>
<div><span style="font-size:12pt">    do na=0,dimsizes(opt@areas_to_exclude)-1</span><br>
</div>
<div><span style="font-size:12pt">      ii := ind(features.eq.opt@areas_to_exclude(na))</span><br>
</div>
<div><span style="font-size:12pt">      if(.not.any(ismissing(ii))) then</span><br>
</div>
<div><span style="font-size:12pt">        features(ii) = features@_FillValue</span><br>
</div>
<div><span style="font-size:12pt">      end if</span><br>
</div>
<div><span style="font-size:12pt">    end do</span><br>
</div>
<div><span style="font-size:12pt">    return(features(ind(.not.ismissing(features))))    ------> </span><span style="color:rgb(87,6,6);font-size:14pt"> line 56</span><br>
</div>
<div><span style="font-size:12pt">  else</span><br>
</div>
<div><span style="font-size:12pt">    return(features)</span><br>
</div>
<div><span style="font-size:12pt">  end if</span><br>
</div>
<span style="font-size:12pt">end</span><br>
</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:14pt;color:rgb(0,0,0)">
<span><span><br>
</span></span></div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:14pt;color:rgb(0,0,0)">
<span style="font-size:12pt">opt                  = True</span><span><br>
</span>
<div><span style="font-size:12pt"> opt@areas_to_exclude = areas_of_interest</span><br>
</div>
<div><span style="font-size:12pt">  areas_to_fill        = get_areas_of_interest(shp_filename1,shape_var_name,opt)    ----></span><span style="font-size:14pt">
</span><span style="color:rgb(87,6,6);font-size:14pt">line 250</span><br>
</div>
<span></span><br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:14pt;color:rgb(0,0,0)"><span style="font-size:12pt">Infos:</span><br></div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:14pt;color:rgb(0,0,0)">
<span><br>
</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:14pt;color:rgb(0,0,0)">
<span><span style="font-size:12pt">0) Terrain Height (m) : min=0   max=5070.39</span><span><br>
</span>
<div><span style="font-size:12pt">(0) ======================================================================</span><br>
</div>
<div><span style="font-size:12pt">(0) Filename: "cuencasx.shp"</span><br>
</div>
<div><span style="font-size:12pt">(0)    Geometry type: polygon</span><br>
</div>
<div><span style="font-size:12pt">(0)    # of features: 4</span><br>
</div>
<div><span style="font-size:12pt">(0)    Min/max lat:    -34.77/ -34.23</span><br>
</div>
<div><span style="font-size:12pt">(0)    Min/max lon:    -70.53/ -70.13</span><br>
</div>
<div><span style="font-size:12pt">(0)    Variable names and their types:</span><br>
</div>
<div><span style="font-size:12pt">(0)        geometry : integer</span><br>
</div>
<div><span style="font-size:12pt">(0)        segments : integer</span><br>
</div>
<div><span style="font-size:12pt">(0)        x : double</span><br>
</div>
<div><span style="font-size:12pt">(0)        y : double</span><br>
</div>
<div><span style="font-size:12pt">(0)        COD_CUEN : string</span><br>
</div>
<div><span style="font-size:12pt">(0)        COD_SUBC : string</span><br>
</div>
<div><span style="font-size:12pt">(0)        COD_SSUBC : string</span><br>
</div>
<div><span style="font-size:12pt">(0)        NOMBRE : string</span><br>
</div>
<div><span style="font-size:12pt">(0)        AREAKM2 : double</span><br>
</div>
<div><span style="font-size:12pt">(0) ======================================================================</span><br>
</div>
<div><br>
</div>
<div><span style="font-size:12pt">Variable: features</span><br></div>
<div><span style="font-size:12pt">Type: string</span><br>
</div>
<div><span style="font-size:12pt">Total Size: 32 bytes</span><br>
</div>
<div><span style="font-size:12pt">            4 values</span><br>
</div>
<div><span style="font-size:12pt">Number of Dimensions: 1</span><br>
</div>
<div><span style="font-size:12pt">Dimensions and sizes: [num_features | 4]</span><br>
</div>
<div><span style="font-size:12pt">Coordinates: </span><br>
</div>
<div><span style="font-size:12pt">Number Of Attributes: 0</span><br>
</div>
<div><span style="font-size:12pt">(0) Cuenca Cipreses</span><br>
</div>
<div><span style="font-size:12pt">(1) Cuenca Coton</span><br>
</div>
<div><span style="font-size:12pt">(2) Cuenca Cortaderal</span><br>
</div>
<div><span style="font-size:12pt">(3) Cuenca Universidad</span><br>
</div>
<div><span style="font-size:12pt">(0) ==================================================</span><br>
</div>
<div><span style="font-size:12pt">(0) Shapefile:         cuencasx.shp</span><br>
</div>
<div><span style="font-size:12pt">(0) Areas of interest: Cuenca Cipreses,Cuenca Coton,Cuenca Cortaderal,Cuenca Universidad</span><br>
</div>
<div><span style="font-size:12pt">(0) min_lat_chk:       -37.4943</span><br>
</div>
<div><span style="font-size:12pt">(0) max_lat_chk:       -31.9474</span><br>
</div>
<div><span style="font-size:12pt">(0) min_lon_chk:       -73.6526</span><br>
</div>
<div><span style="font-size:12pt">(0) max_lon_chk:       -66.7254</span><br>
</div>
<div><span style="font-size:12pt">(0) min_lat_data:      -37.4943</span><br>
</div>
<div><span style="font-size:12pt">(0) max_lat_data:      -31.9474</span><br>
</div>
<div><span style="font-size:12pt">(0) min_lon_data:      -73.6526</span><br>
</div>
<div><span style="font-size:12pt">(0) max_lon_data:      -66.7254</span><br>
</div>
<div><span style="font-size:12pt">(0) 4761 data values originally</span><br>
</div>
<div><span style="font-size:12pt">(0) Will keep data values inside given shapefile areas</span><br>
</div>
<div><span style="font-size:12pt">(0) ==================================================</span><br>
</div>
<div><span style="font-size:12pt">(0) 13 data values kept</span><br>
</div>
<div><span style="font-size:12pt">(0) shapefile_mask_data: elapsed time: 0.00758901 CPU seconds.</span><br>
</div>
<div><span style="font-size:12pt">(0) ==================================================</span><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><b style="font-size:11pt;font-family:Calibri,sans-serif">De:</b><span style="font-size:11pt;font-family:Calibri,sans-serif"> Dave Allured - NOAA Affiliate <</span><a href="mailto:dave.allured@noaa.gov" target="_blank" style="font-size:11pt;font-family:Calibri,sans-serif">dave.allured@noaa.gov</a><span style="font-size:11pt;font-family:Calibri,sans-serif">></span><br></div></span></div><div id="gmail-m_1098706355727375035divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000">
<b>Enviado:</b> domingo, 27 de janeiro de 2019 18:23<br>
<b>Para:</b> Vanúcia Schumacher<br>
<b>Cc:</b> <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
<b>Assunto:</b> Re: [ncl-talk] shapefiles</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">Vanúcia,</div>
<div dir="ltr"><br>
</div>
<div>Your two data files are on different grids.  If you only need to make plots that show the same region on a map, then use graphics masking, not data masking.  See the third plot in example shapefiles_21 on this page:</div>
<div><br>
</div>
<div><a href="https://www.ncl.ucar.edu/Applications/shapefiles.shtml" target="_blank">https://www.ncl.ucar.edu/Applications/shapefiles.shtml</a><br>
</div>
<div><br>
</div>
<div>If you need to perform calculations between the two data sets, then you will need to regrid the data from one file to match the other grid.  Please see this documentation for regridding:</div>
<div><br>
</div>
<div><a href="https://www.ncl.ucar.edu/Applications/regrid.shtml" target="_blank">https://www.ncl.ucar.edu/Applications/regrid.shtml</a><br>
</div>
<div><a href="https://www.ncl.ucar.edu/Applications/ESMF.shtml" target="_blank">https://www.ncl.ucar.edu/Applications/ESMF.shtml</a><br>
</div>
<div><br>
</div>
<div>--Dave</div>
<div><br>
</div>
<br>
<div class="gmail-m_1098706355727375035x_gmail_quote">
<div dir="ltr" class="gmail-m_1098706355727375035x_gmail_attr">On Sun, Jan 27, 2019 at 12:40 PM Vanúcia Schumacher <<a href="mailto:vanucia-schumacher@hotmail.com" target="_blank">vanucia-schumacher@hotmail.com</a>> wrote:<br>
</div>
<blockquote class="gmail-m_1098706355727375035x_gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:14pt;color:rgb(0,0,0)">
<div style="margin:0px;font-size:14pt;font-family:Calibri,Helvetica,sans-serif,serif,EmojiFont;background-color:rgb(255,255,255)">
Hi all,</div>
<div style="margin:0px;font-size:14pt;font-family:Calibri,Helvetica,sans-serif,serif,EmojiFont;background-color:rgb(255,255,255)">
<br>
</div>
<div style="margin:0px;font-size:14pt;font-family:Calibri,Helvetica,sans-serif,serif,EmojiFont;background-color:rgb(255,255,255)">
I need support to find the problem with my script, <span style="margin:0px">with the purpose of cutting two different data in a shapefile, </span><span style="margin:0px">but keeping the information such as time lat and<span> </span></span>lon.</div>
<div style="margin:0px;font-size:14pt;font-family:Calibri,Helvetica,sans-serif,serif,EmojiFont;background-color:rgb(255,255,255)">
My script (attachment) is "cutting" the region from shapefile different for each input (data) (see Figure attachment).<br>
</div>
<div style="margin:0px;font-size:14pt;font-family:Calibri,Helvetica,sans-serif,serif,EmojiFont;background-color:rgb(255,255,255)">
I'd like to select the shapefile region of the same size independent of the input file, and keep the time, lat, and lon information.<br>
</div>
<div style="margin:0px;font-size:14pt;font-family:Calibri,Helvetica,sans-serif,serif,EmojiFont;background-color:rgb(255,255,255)">
<br>
</div>
<div style="margin:0px;font-size:14pt;font-family:Calibri,Helvetica,sans-serif,serif,EmojiFont;background-color:rgb(255,255,255)">
I appreciate any help</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

</blockquote></div></div>