[ncl-talk] Swapped x, y coordinates of shapefile?

Holman, Kathleen D kholman at usbr.gov
Mon Jan 25 15:30:17 MST 2021


Hello,

I am trying to use the shapefile_mask_data() function to mask precipitation data (time, lat, lon) using boundaries defined in a shapefile, subs_buff_mod.shp.  When I plot the shapefile in ArcGIS, the spatial extent appears correct (see screenshot).  This basin is in Colorado, so the latitude extent should be between 40 and 40.5 north, while the longitude extent should be between -106 and -105 east.  Unfortunately, the mask function continues to produce missing values, and I *think* the reason for this is because the x and y coordinates of the shapefile are getting swapped when I import the shapefile into NCL.  Here is a snippet of text from the print_shapefile_info() command.  The latitude and longitude ranges are swapped from what they should be for Colorado, but again, the shapefile properly plots in ArcGIS.  Can I swap the coordinates somehow?  Any idea where this happening or how to remedy this?

(0)     ======================================================================
(0)     Filename: "../GIS/subs_buff_mod.shp"
(0)        Geometry type: polygon
(0)        # of features: 8
(0)        Min/max lat:   -105.82/-105.45
(0)        Min/max lon:     40.23/  40.50
(0)        Variable names and their types:
(0)            geometry : integer
(0)            segments : integer
(0)            x : double
(0)            y : double
(0)            Shape_Leng : double
(0)            Shape_Area : double
(0)            HydroID : int64
(0)            Name : string
(0)            BUFF_DIST : double
(0)            ORIG_FID : int64
(0)     ======================================================================

Here are the min/max values of the latitude and longitude coordinates associated with the precipitation data.

(0)     latitude (degrees_north) : min=36.532672   max=50.232124
(0)
(0)     longitude (degrees_east) : min=-114.7339440000123   max=-90.00160000003234


[cid:32dda634-75f4-421f-94e3-be3cb84ae436]

Thank you,

Katie Holman, PhD
Meteorologist
Technical Service Center
Bureau of Reclamation
303-445-2571
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210125/667bc51b/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 655381 bytes
Desc: image.png
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210125/667bc51b/attachment-0001.png>


More information about the ncl-talk mailing list