0

I need to reproject a set of data in a numpy array with a shape of (121, 160) with

crs='+proj=merc +units=meters +a=6370000.0 +b=6370000.0 +lon_0=-76.0100021362 +lat_ts=20.3180007935 +nadgrids=@null' 

To crs="epsg:4326" in the location

Upper Left  ( -96.5979538,   5.2124481) ( 96d35'52.63"W,  5d12'44.81"N)
Lower Left  ( -96.5979538,  34.0865555) ( 96d35'52.63"W, 34d 5'11.60"N)
Upper Right ( -55.4220505,   5.2124481) ( 55d25'19.38"W,  5d12'44.81"N)
Lower Right ( -55.4220505,  34.0865555) ( 55d25'19.38"W, 34d 5'11.60"N)
Center      ( -76.0100021,  19.6495018) ( 76d 0'36.01"W, 19d38'58.21"N)

I am currently doing

    crs4326 = CRS.from_string('epsg:4326')
    affine = from_origin(x.min(), y.max(), xLength/xCellCount, yLength/yCellCount)

    dstTransform, width, heigth = calculate_default_transform(
        originCRS,
        crs4326,
        xCellCount,
        yCellCount,
        x.min(),
        y.min(),
        x.max(),
        y.max()
    )

    destination = np.zeros((heigth, width), np.float32)
    reproject(
        var,
        destination,
        src_transform=affine,
        dst_transform=dstTransform,
        src_crs=netcdfAttributes['crs'],
        dst_crs=crs4326,
        resampling=Resampling.nearest
    )

But for some reason the image deforms look at the bottom

enter image description here

  • @MarceloVilla please read again the post I have updated it – miggy92 Mar 17 at 19:50
  • 3
    There is something strange about the extent of your data... Where is it supposed to be in the world? Your extent is tiny and near Null Island in Africa with values such as 0d 0' 2.46"W, 0d 0' 0.64"N. The x,y values look like they could be longitudes and latitudes already, and that would correpond to an extent in North/Central America. – FSimardGIS Mar 17 at 21:56
  • @FSimardGIS, could you read the question again? I have updated it – miggy92 Mar 18 at 20:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.