Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/cartoee orientation #183

Merged
merged 3 commits into from
Nov 24, 2020
Merged

Bugfix/cartoee orientation #183

merged 3 commits into from
Nov 24, 2020

Conversation

KMarkert
Copy link
Member

cartoee was producing plots with imagery being oriented wrongly, see #177. This was due to data being requested without a fixed spatial reference. This PR fixes the bug by adding the crs parameter when requesting data from EE.

It should be noted that the only CRS support for EE requests as of now is WGS84 (EPSG:4326). This is because it is the only CRS directly transferable to a cartopy.crs projection. This forces all of the EE computations in WGS84 which is not so ideal but allows the reprojections to cartopy crs be done locally with correct plotting.

@giswqs
Copy link
Member

giswqs commented Nov 24, 2020

/ok-to-test

@giswqs giswqs merged commit 63ef130 into master Nov 24, 2020
@giswqs giswqs deleted the bugfix/cartoee-orientation branch November 24, 2020 14:09
@giswqs giswqs mentioned this pull request Nov 24, 2020
@eselrodrigo
Copy link

eselrodrigo commented Dec 17, 2021

The solution proposed didn't work for me, I think it's not a coordinates system problem but a matrix mirroring problem in this part of the "add_layer" module inside cartoee.py:

image = np.array(Image.open(BytesIO(response.content)))

if image.shape[-1] == 2:
    image = np.concatenate(
        [np.repeat(image[:, :, 0:1], 3, axis=2), image[:, :, -1:]], axis=2
    )

for witch the solution was adding a left right flip to the final image (np.fliplr(np.squeeze(image))),

ax.imshow(
    np.fliplr(np.squeeze(image)),
    extent=view_extent,
    origin="upper",
    transform=ccrs.PlateCarree(),
)

image

Sorry I didn't have time to study the exact part of the matrix array that originates the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants