Skip to content

Issues in the Southern Hemisphere  #49

@hgopalan

Description

@hgopalan

I was trying to use a modified version of the windtools. to generate terrain data for Reunion island (centerLat: -21.1
centerLon: 55.52) in the Southern Hemisphere. I noticed that the terrain heights were alll zero. So I looked into the code and noticed an issue with the following lines:

srtm = SRTM(srtm_bounds, fpath=srtm_output, product=product)
if(tiffile==' '):
    srtm.download()
x,y,z = srtm.to_terrain()
xref,yref,_,_ = utm.from_latlon(*refloc[:2],force_zone_number=srtm.zone_number)

For the terrain height interpolation to work properly yref should be within the minimum and maximum values of y and similarly for x. However, for Reunion island, y was negative and yref was positive values. When I modified the code to

y=y+yref-0.5*(np.amax(y)+np.amin(y))

The terrain heights were properly aligned. We need to check in the future for easting too to ensure that the projects match.

Code Snippet:

srtm = SRTM(srtm_bounds, fpath=srtm_output, product=product)
if(tiffile==' '):
    srtm.download()
x,y,z = srtm.to_terrain()
xref,yref,_,_ = utm.from_latlon(*refloc[:2],force_zone_number=srtm.zone_number)
vmin,vmax = 1500,2500
print(xref,yref)
print(np.amax(x),np.amin(x),np.amax(x)-np.amin(x))
print(np.amax(y),np.amin(y),np.amax(y)-np.amin(y))
y=y+yref-0.5*(np.amax(y)+np.amin(y))
print("Center:",0.5*(np.amax(y)+np.amin(y)))
print("After mixing:",np.amax(y),np.amin(y),np.amax(y)-np.amin(y))
if(np.amin(z)<0):
    z[z < 0] = 0
exit(-1)

Output:

Projecting from EPSG:4326 to EPSG:32640
346275.28805958736 7666070.1667040605
401626.61855032045 286276.61855032045 115350.0
-2274626.9467327525 -2392406.9467327525 117780.0
Center: 7666070.1667040605
After mixing: 7724960.1667040605 7607180.1667040605 117780.0

When y=y+yref-0.5*(np.amax(y)+np.amin(y)) is commented out.

Output:

Projecting from EPSG:4326 to EPSG:32640
346275.28805958736 7666070.1667040605
401626.61855032045 286276.61855032045 115350.0
-2274626.9467327525 -2392406.9467327525 117780.0
Center: -2333516.9467327525
After mixing: -2274626.9467327525 -2392406.9467327525 117780.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions