Skip to content
This repository was archived by the owner on Sep 11, 2023. It is now read-only.

Conversation

peterdudfield
Copy link
Contributor

@peterdudfield peterdudfield commented Sep 27, 2021

Pull Request

Description

Removed warning about
"UserWarning: Geometry is in a geographic CRS. Results from 'centroid' are likely incorrect."

Fixes issue #154

How Has This Been Tested?

  • normal unittests

  • added small change to unitest

  • run ploting script

  • No

  • Yes

Checklist:

  • My code follows OCF's coding style guidelines
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked my code and corrected any misspellings

@peterdudfield peterdudfield marked this pull request as ready for review September 27, 2021 11:10
@peterdudfield
Copy link
Contributor Author

ok to merge this @JackKelly ?

Copy link
Contributor

@JackKelly JackKelly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Just a few quick thoughts. Sorry for taking a while to review this!


logger = logging.getLogger(__name__)

rename_save_columns = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe in another PR, we could make it so we don't have to rename the columns, but instead we use the same column names throughout the code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea I did this as the column names seemed to be limited to 10, but let me check this again

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And then its a balance of a bit of extra code here to give full verbose, compared to a shorter column name and it not being as verbose. Personally I like the fully verbose version

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, sorry, my mistake... I hadn't realised shapefiles have these limitations! Thanks for explaining. Cool, let's leave the code as-is!

)

# project to WGS84
shape_gpd = shape_gpd.to_crs(WGS84_CRS)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still necessary? I think the satellite data and the NWPs are in OSGB projection in the batches, right? It'd be good to keep all the geospatial data in the same projection in the batches. Or have I misunderstood?!

locations_x, locations_y = gsp.get_locations_for_batch(t0_datetimes=gsp.gsp_power.index[0:10])

assert len(locations_x) == len(locations_y)
assert locations_x[0] > 90 # this makes sure it is not in lat/lon
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OSGB coordinates can be less than or equal to 90 :) I'm not sure of any perfect way to assert that a coordinate is OSGB or lat,lon. Other than, maybe, checking that it's within a certain geospatial boundary (e.g. is it on land within the UK?) But that's maybe overkill?!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, good point, I think if it was less than 90 it would be in the sea - and we shouldnt have a GSP centroid there, so I'm happy to keep it like this - perhaps Ill add a comment in the code?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, sounds good: Leave the code as-it but add a comment to explain...

@peterdudfield peterdudfield merged commit 5a80d7e into main Sep 29, 2021
@peterdudfield peterdudfield deleted the bug/154-crs-warning branch September 29, 2021 09:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"UserWarning: Geometry is in a geographic CRS. Results from 'centroid' are likely incorrect."

2 participants