[ncl-talk] Swapped x, y coordinates of shapefile?
Rick Brownrigg
brownrig at ucar.edu
Mon Jan 25 15:53:04 MST 2021
Hi,
Yes, there have been reports of this with NCL v6.6.2 as distributed via
conda (does that describe your circumstances?) I don't know the root cause
nor am I in a position to investigate. However, as a kludge, you can
certainly swap the shapefile's x/y coordinates in any of a number of ways,
perhaps something like:
myShpFile = addfile(....)
...
theActualXCoord = myShpFile->y ; Swap X/Y to fix known bug...
theActualYCoord = myShpFile->x
Hope that helps...
Rick
On Mon, Jan 25, 2021 at 3:30 PM Holman, Kathleen D via ncl-talk <
ncl-talk at mailman.ucar.edu> wrote:
> 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
>
>
>
>
> Thank you,
>
> Katie Holman, PhD
> Meteorologist
> Technical Service Center
> Bureau of Reclamation
> 303-445-2571
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at mailman.ucar.edu
> List instructions, subscriber options, unsubscribe:
> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210125/65742cb0/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 655381 bytes
Desc: not available
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210125/65742cb0/attachment-0001.png>
More information about the ncl-talk
mailing list