<div dir="ltr"><div>Actually, it turned out to be quite easy to deproject the file with ogr2ogr:</div><div><br></div><div> ogr2ogr -t_srs EPSG:4326 Perimeter_20180715_SpringCreek_COHUX001313_latlon.shp Perimeter_20180715_SpringCreek_COHUX001313.shp</div><div><br></div><div>The resultant coords are definitely in lat/lon and look like values for Colorado. I *assume* ogr2gr used the information in the *.prj file, to properly set up the requisite deprojection parameters -- check that the outline is spatially registered correctly. Also, the swapped X/Y *may* still be an issue, I can't tell.</div><div><br></div><div>Rick</div><div> <br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 6, 2022 at 12:17 PM Rick Brownrigg <<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</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>Hi Vanessa,</div><div><br></div><div>The issue is that the Perimeter_xxxx.shp file's coordinates are in meters in a Mercator Projection, as seen by the associated Perimeter_xxxx.prj file (and verified by using NCL to print the x/y coordinates). NCL can only deal with shapefiles in geographic (lat/lon) coordinates. It's not clear to me whether the X/Y values are also swapped in this case; I can't tell by looking at the values.</div><div><br></div><div>There are a couple of ways forward: The GDAL package has a command, ogr2ogr, that in principle, can perform the needed deprojection. Another possible solution is that NCL has an undocumented interface to the PROJ cartographic projection library that could do the deproject. Both of these would take me some experimentation to get it right. I won't be able to give it a try until later this evening. <br></div><div><br></div><div>Perhaps the best, easiest, and do-it-yourself solution is that if you have access to GIS tools such as ArcGIS, that could also create a geographic-coords version of your shapefile.</div><div><br></div><div>Rick <br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 6, 2022 at 11:36 AM Vanessa Vincente via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</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">Thank you for sharing this workaround. I have replaced the shapefile_utils.ncl with the one provided, and ran the code, but it is still not displaying the burn scar perimeter polygon. I am running the ncl code in the directory that houses all the shapefiles and the new shapefile_utils.ncl.<div><br></div><div><div>I am using version 6.6.2 and the source of the NCL installation was conda 4.11.0.</div></div><div>Below is a copy of my code again for reference.</div><div><br>load "./shapefile_utils.ncl"<br><br>;----------------------------------------------------------------------<br>; This function creates a cylindrical equidistant map of Colorado.<br>;----------------------------------------------------------------------<br><br>function create_colorado_map(wks,res,draw_ncl_outlines)<br>local a, mpres<br>begin<br> mpres = res<br><br> mpres@gsnMaximize = True<br> mpres@gsnPaperOrientation = "portrait"<br><br> mpres@gsnDraw = False<br> mpres@gsnFrame = False<br><br> mpres@mpFillOn = False <br><br>;---Turn on fancier tickmark labels.<br> mpres@pmTickMarkDisplayMode = "Always"<br> mpres@tmXBLabelFontHeightF = 0.008 ; smaller tickmark labels<br><br>;---Zoom in on area of interest<br> mpres@mpLimitMode = "LatLon"<br> mpres@mpMinLatF = 37<br> mpres@mpMaxLatF = 41<br> mpres@mpMinLonF = -109.05<br> mpres@mpMaxLonF = -102.05<br> mpres@mpFillOn = False<br><br> if(draw_ncl_outlines) then<br> mpres@mpOutlineOn = True<br> mpres@mpOutlineBoundarySets = "AllBoundaries"<br> mpres@mpDataBaseVersion = "MediumRes"<br> mpres@mpDataSetName = "Earth..4" ; U.S. counties<br> else<br> mpres@mpOutlineOn = False<br> end if<br><br>;---Create map.<br> map = gsn_csm_map(wks,mpres)<br><br> return(map)<br>end<br><br>;--------------------------------------------------<br>; Main code<br>;--------------------------------------------------<br>begin<br> wtype = "png" ; send graphics to PNG file<br> wtype@wkWidth = 2000<br> wtype@wkHeight = 2000<br> wks = gsn_open_wks(wtype,"shapefiles")<br><br> ncl_version = get_ncl_version()<br><br>;---Create two maps of Colorado<br> res = True<br> res@tiMainFontHeightF = 0.015<br> <br> res@tiMainString = "Colorado counties - shapefile"<br> map_shp = create_colorado_map(wks,res,False)<br><br> res@tiMainString = "Colorado counties - NCL (version " + ncl_version + ")"<br> map_ncl = create_colorado_map(wks,res,True)<br><br>;---Add shapefiles to one of the maps<br> lnres = True<br> lnres@gsLineColor = "red"<br><br> plot_line_shp = gsn_add_shapefile_polylines(wks,map_shp,"./usa/gadm40_USA_2.shp",lnres)<br><br>;---Add a slightly transparent marker to both maps to show location of county updates<br> mkres = True<br> mkres@gsMarkerIndex = 16 ; filled dot<br> mkres@gsMarkerOpacityF = 0.5 ; make the marker half transparent<br> mkres@gsMarkerColor = "red"<br> mkres@gsMarkerSizeF = 50.<br><br> counties_lat_center = 39.8<br> counties_lon_center = -104.9<br> <br> plot_marker_ncl = gsn_add_polymarker(wks,map_ncl,counties_lon_center,counties_lat_center,mkres)<br> plot_marker_shp = gsn_add_polymarker(wks,map_shp,counties_lon_center,counties_lat_center,mkres)<br><br>print("Adding polygons to ncl map and shp map...")<br><br>filename = "Perimeter_20180715_SpringCreek_COHUX001313.shp"<br> <br> ;---Set some options for the polygons<br> bscar = True<br> bscar@gsLineColor = "Blue"<br> bscar@gsLineThicknessF = 3.0 ; 3x thickness<br> <br>id1 = gsn_add_shapefile_polygons(wks,map_ncl,filename,bscar)<br>id2 = gsn_add_shapefile_polygons(wks,map_shp,filename,bscar)<br><br>;---Panel both plots. Markers, lines, and polygons will be drawn.<br> pres = True<br> pres@gsnMaximize = True<br> gsn_panel(wks,(/map_ncl,map_shp/),(/1,2/),pres)<br> <br>end<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 5, 2022 at 4:39 PM Dave Allured - NOAA Affiliate <<a href="mailto:dave.allured@noaa.gov" target="_blank">dave.allured@noaa.gov</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>You may have encountered a known bug whereby the X and Y coordinates from a shapefile are swapped with each other. We think this was caused by a change in an underlying library. Please see this report for details and a possible easy workaround. Let us know if that works.</div><div><br></div><div> <a href="https://github.com/NCAR/ncl/issues/176" target="_blank">https://github.com/NCAR/ncl/issues/176</a><br></div><div><br></div><div>What version of NCL are you using, and what was the source of your NCL installation?</div><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 5, 2022 at 4:29 PM Vanessa Vincente via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</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">Hello,<div><br></div><div>I am having trouble plotting polygon data from a shapefile of a burn scar perimeter over a map of Colorado with counties. I am using the example shapefiles_15.ncl from the <a href="https://www.ncl.ucar.edu/Applications/shapefiles.shtml" target="_blank">ncl page</a>. I am able to successfully plot the state of Colorado and its counties, but not the burn scar perimeter. Burn scar shapefile can be found <a href="https://ftp.wildfire.gov/public/incident_specific_data/rocky_mtn/2018/SpringCreek/IR/20180715/PerimeterFileProvidedByIncident/" target="_blank">here</a>. Can you please help? Thanks in advance!</div><div><br></div><div>Below is a copy of my ncl script:</div><div><br></div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"<br>load "./shapefile_utils.ncl"<br><br>;----------------------------------------------------------------------<br>; This function creates a cylindrical equidistant map of Colorado.<br>;----------------------------------------------------------------------<br><br>function create_colorado_map(wks,res,draw_ncl_outlines)<br>local a, mpres<br>begin<br> mpres = res<br><br> mpres@gsnMaximize = True<br> mpres@gsnPaperOrientation = "portrait"<br><br> mpres@gsnDraw = False<br> mpres@gsnFrame = False<br><br> mpres@mpFillOn = False <br><br>;---Turn on fancier tickmark labels.<br> mpres@pmTickMarkDisplayMode = "Always"<br> mpres@tmXBLabelFontHeightF = 0.008 ; smaller tickmark labels<br><br>;---Zoom in on area of interest<br> mpres@mpLimitMode = "LatLon"<br> mpres@mpMinLatF = 37<br> mpres@mpMaxLatF = 41<br> mpres@mpMinLonF = -109.05<br> mpres@mpMaxLonF = -102.05<br> mpres@mpFillOn = False<br><br> if(draw_ncl_outlines) then<br> mpres@mpOutlineOn = True<br> mpres@mpOutlineBoundarySets = "AllBoundaries"<br> mpres@mpDataBaseVersion = "MediumRes"<br> mpres@mpDataSetName = "Earth..4" ; U.S. counties<br> else<br> mpres@mpOutlineOn = False<br> end if<br><br>;---Create map.<br> map = gsn_csm_map(wks,mpres)<br><br> return(map)<br>end<br><br>;--------------------------------------------------<br>; Main code<br>;--------------------------------------------------<br>begin<br> wtype = "png" ; send graphics to PNG file<br> wtype@wkWidth = 2000<br> wtype@wkHeight = 2000<br> wks = gsn_open_wks(wtype,"shapefiles")<br><br> ncl_version = get_ncl_version()<br><br>;---Create two maps of Colorado<br> res = True<br> res@tiMainFontHeightF = 0.015<br> <br> res@tiMainString = "Colorado counties - shapefile"<br> map_shp = create_colorado_map(wks,res,False)<br><br> res@tiMainString = "Colorado counties - NCL (version " + ncl_version + ")"<br> map_ncl = create_colorado_map(wks,res,True)<br><br>;---Add shapefiles to one of the maps<br> lnres = True<br> lnres@gsLineColor = "red"<br><br> plot_line_shp = gsn_add_shapefile_polylines(wks,map_shp,"./usa/gadm40_USA_2.shp",lnres)<br><br>;---Add a slightly transparent marker to both maps to show location of county updates<br> mkres = True<br> mkres@gsMarkerIndex = 16 ; filled dot<br> mkres@gsMarkerOpacityF = 0.5 ; make the marker half transparent<br> mkres@gsMarkerColor = "red"<br> mkres@gsMarkerSizeF = 50.<br><br> counties_lat_center = 39.8<br> counties_lon_center = -104.9<br> <br> plot_marker_ncl = gsn_add_polymarker(wks,map_ncl,counties_lon_center,counties_lat_center,mkres)<br> plot_marker_shp = gsn_add_polymarker(wks,map_shp,counties_lon_center,counties_lat_center,mkres)<br><br>print("Adding polygons to ncl map and shp map...")<br><br>filename = "Perimeter_20180715_SpringCreek_COHUX001313.shp"<br> <br> ;---Set some options for the polygons<br> bscar = True<br> bscar@gsLineColor = "Blue"<br> bscar@gsLineThicknessF = 3.0 ; 3x thickness<br> <br>id1 = gsn_add_shapefile_polygons(wks,map_ncl,filename,bscar)<br>id2 = gsn_add_shapefile_polygons(wks,map_shp,filename,bscar)<br><br>;---Panel both plots. Markers, lines, and polygons will be drawn.<br> pres = True<br> pres@gsnMaximize = True<br> gsn_panel(wks,(/map_ncl,map_shp/),(/1,2/),pres)<br> <br>end</div>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><font color="#000000">Vanessa Vincente<br>Associate Scientist<br>The COMET® Program<br>University Corporation for Atmospheric Research<br></font><br>*My working hours may differ from your own. Please do not feel obligated to reply outside of standard business hours.*<div dir="ltr"></div></div></div></div></div></div></div></div></div></div></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="https://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><font color="#000000">Vanessa Vincente<br>Associate Scientist<br>The COMET® Program<br>University Corporation for Atmospheric Research<br></font><br>*My working hours may differ from your own. Please do not feel obligated to reply outside of standard business hours.*<div dir="ltr"></div></div></div></div></div></div></div></div></div></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="https://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div>
</blockquote></div></div>