René's URL Explorer Experiment


Title: Adding cyclic point feature · Issue #82 · proplot-dev/proplot · GitHub

Open Graph Title: Adding cyclic point feature · Issue #82 · proplot-dev/proplot

X Title: Adding cyclic point feature · Issue #82 · proplot-dev/proplot

Description: I will address the same issue as for Cartopy (SciTools/cartopy#1402). I would find extremely useful to have an automatic behavior of adding a cyclic point when needed, or at least add an option when doing a plot. Here is an example of wh...

Open Graph Description: I will address the same issue as for Cartopy (SciTools/cartopy#1402). I would find extremely useful to have an automatic behavior of adding a cyclic point when needed, or at least add an option whe...

X Description: I will address the same issue as for Cartopy (SciTools/cartopy#1402). I would find extremely useful to have an automatic behavior of adding a cyclic point when needed, or at least add an option whe...

Opengraph URL: https://github.com/proplot-dev/proplot/issues/82

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Adding cyclic point feature","articleBody":"I will address the same issue as for **Cartopy** (https://github.com/SciTools/cartopy/issues/1402). I would find extremely useful to have an automatic behavior of adding a **cyclic point** when needed, or at least add an option when doing a plot. \r\n\r\nHere is an example of what I mean (data: [ens_avg_snow.zip](https://github.com/lukelbd/proplot/files/3922831/ens_avg_snow.zip)):\r\n```python\r\nimport xarray as xr\r\nimport proplot as plot\r\n\r\nens_avg_snow = xr.open_dataarray('ens_avg_snow.nc')\r\n\r\nf, axs = plot.subplots(proj='cyl', width=8)\r\nm = axs[0].contourf(ens_avg_snow, cmap='BuRd')\r\nf.colorbar(m)\r\naxs.format(\r\n    geogridlinewidth=0.5, geogridcolor='gray8', geogridalpha=0.5, labels=True, \r\n    coast=True, ocean=True, oceancolor='gray3', latlim=(20,90),\r\n)\r\n```\r\n![proplot_cyclic_point](https://user-images.githubusercontent.com/20254164/70159609-7c655d00-16b9-11ea-8775-196183f02eb7.jpg)\r\n\r\nAs you can see, there is a white line at 0° of longitude. I usually use the `add_cyclic_point` function of `cartopy.utils` but it is not straightforward for DataArrays because it doesn't keep the coordinates and attributes. I recently found some very useful code here: https://github.com/darothen/plot-all-in-ncfile/blob/master/plot_util.py that allows to do it easily with the function `cyclic_dataarray` and there is also a `check_cyclic` that could be used for automatically checking it.\r\n\r\nHere is the function that allows adding a cyclic point (from the link above):\r\n```python\r\nfrom cartopy.util import add_cyclic_point\r\n\r\n# https://github.com/darothen/plot-all-in-ncfile/blob/master/plot_util.py\r\ndef cyclic_dataarray(da, coord='lon'):\r\n    \"\"\" Add a cyclic coordinate point to a DataArray along a specified\r\n    named coordinate dimension.\r\n    \"\"\"\r\n    assert isinstance(da, xr.DataArray)\r\n\r\n    lon_idx = da.dims.index(coord)\r\n    cyclic_data, cyclic_coord = add_cyclic_point(da.values,\r\n                                                 coord=da.coords[coord],\r\n                                                 axis=lon_idx)\r\n\r\n    # Copy and add the cyclic coordinate and data\r\n    new_coords = dict(da.coords)\r\n    new_coords[coord] = cyclic_coord\r\n    new_values = cyclic_data\r\n\r\n    new_da = xr.DataArray(new_values, dims=da.dims, coords=new_coords)\r\n\r\n    # Copy the attributes for the re-constructed data and coords\r\n    for att, val in da.attrs.items():\r\n        new_da.attrs[att] = val\r\n    for c in da.coords:\r\n        for att in da.coords[c].attrs:\r\n            new_da.coords[c].attrs[att] = da.coords[c].attrs[att]\r\n\r\n    return new_da\r\n```\r\nThus `ens_avg_snow_cyclic = cyclic_dataarray(ens_avg_snow)` allows to make back the previous plot without the white line. Incorporating this directly into **ProPlot** would be nice so that we can just add an option like for example `add_cyclic=True` (just need to be careful about the dimension to do the cyclic or have another way to pass it). \r\n\r\n\r\n","author":{"url":"https://github.com/mickaellalande","@type":"Person","name":"mickaellalande"},"datePublished":"2019-12-04T16:27:00.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":13},"url":"https://github.com/82/proplot/issues/82"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:533e4a51-e493-feb3-4e2b-951d3301ca25
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idAA20:DF8C:2B80C88:3C6A0C7:697CCFFA
html-safe-nonce32738e51123dec0a26e91dba97c839592c1c7cd34d01a9a247dc9e8d62128aca
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQTIwOkRGOEM6MkI4MEM4ODozQzZBMEM3OjY5N0NDRkZBIiwidmlzaXRvcl9pZCI6Ijg2Mjg3MzY5Njg5OTkzNTg0NTgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacac754862c84c5e000bcbbac0633cf2b62846f0d51ccf828fae720b4ca28d40fe
hovercard-subject-tagissue:532795098
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/proplot-dev/proplot/82/issue_layout
twitter:imagehttps://opengraph.githubassets.com/396fe6508d55e47c477cc4766a316babed9f9297831d3c3c51b0a93c62b7d1d0/proplot-dev/proplot/issues/82
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/396fe6508d55e47c477cc4766a316babed9f9297831d3c3c51b0a93c62b7d1d0/proplot-dev/proplot/issues/82
og:image:altI will address the same issue as for Cartopy (SciTools/cartopy#1402). I would find extremely useful to have an automatic behavior of adding a cyclic point when needed, or at least add an option whe...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemickaellalande
hostnamegithub.com
expected-hostnamegithub.com
None885404032cf4ce82316fdeed2c19c8ed247605e75fd124f8b52e9e12339174a9
turbo-cache-controlno-preview
go-importgithub.com/proplot-dev/proplot git https://github.com/proplot-dev/proplot.git
octolytics-dimension-user_id108025793
octolytics-dimension-user_loginproplot-dev
octolytics-dimension-repository_id113293661
octolytics-dimension-repository_nwoproplot-dev/proplot
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id113293661
octolytics-dimension-repository_network_root_nwoproplot-dev/proplot
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release93330c3718e60cdbbb9384d677bd8a01675b3f9c
ui-targetcanary-2
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/proplot-dev/proplot/issues/82#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fproplot-dev%2Fproplot%2Fissues%2F82
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fproplot-dev%2Fproplot%2Fissues%2F82
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=proplot-dev%2Fproplot
Reloadhttps://github.com/proplot-dev/proplot/issues/82
Reloadhttps://github.com/proplot-dev/proplot/issues/82
Reloadhttps://github.com/proplot-dev/proplot/issues/82
proplot-dev https://github.com/proplot-dev
proplothttps://github.com/proplot-dev/proplot
Notifications https://github.com/login?return_to=%2Fproplot-dev%2Fproplot
Fork 97 https://github.com/login?return_to=%2Fproplot-dev%2Fproplot
Star 1.1k https://github.com/login?return_to=%2Fproplot-dev%2Fproplot
Code https://github.com/proplot-dev/proplot
Issues 88 https://github.com/proplot-dev/proplot/issues
Pull requests 7 https://github.com/proplot-dev/proplot/pulls
Discussions https://github.com/proplot-dev/proplot/discussions
Actions https://github.com/proplot-dev/proplot/actions
Projects 0 https://github.com/proplot-dev/proplot/projects
Security 0 https://github.com/proplot-dev/proplot/security
Insights https://github.com/proplot-dev/proplot/pulse
Code https://github.com/proplot-dev/proplot
Issues https://github.com/proplot-dev/proplot/issues
Pull requests https://github.com/proplot-dev/proplot/pulls
Discussions https://github.com/proplot-dev/proplot/discussions
Actions https://github.com/proplot-dev/proplot/actions
Projects https://github.com/proplot-dev/proplot/projects
Security https://github.com/proplot-dev/proplot/security
Insights https://github.com/proplot-dev/proplot/pulse
New issuehttps://github.com/login?return_to=https://github.com/proplot-dev/proplot/issues/82
New issuehttps://github.com/login?return_to=https://github.com/proplot-dev/proplot/issues/82
Adding cyclic point featurehttps://github.com/proplot-dev/proplot/issues/82#top
supporthttps://github.com/proplot-dev/proplot/issues?q=state%3Aopen%20label%3A%22support%22
https://github.com/mickaellalande
https://github.com/mickaellalande
mickaellalandehttps://github.com/mickaellalande
on Dec 4, 2019https://github.com/proplot-dev/proplot/issues/82#issue-532795098
SciTools/cartopy#1402https://github.com/SciTools/cartopy/issues/1402
ens_avg_snow.ziphttps://github.com/lukelbd/proplot/files/3922831/ens_avg_snow.zip
https://user-images.githubusercontent.com/20254164/70159609-7c655d00-16b9-11ea-8775-196183f02eb7.jpg
https://github.com/darothen/plot-all-in-ncfile/blob/master/plot_util.pyhttps://github.com/darothen/plot-all-in-ncfile/blob/master/plot_util.py
supporthttps://github.com/proplot-dev/proplot/issues?q=state%3Aopen%20label%3A%22support%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.