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

Support netcdf file #127

Closed
zxdawn opened this issue Nov 5, 2021 · 3 comments · Fixed by #226
Closed

Support netcdf file #127

zxdawn opened this issue Nov 5, 2021 · 3 comments · Fixed by #226
Labels
Feature Request New feature or request help wanted Extra attention is needed

Comments

@zxdawn
Copy link
Contributor

zxdawn commented Nov 5, 2021

Description

As geemap has supported the netcdf file (gee-community/geemap#285), it's better to add it to leafmap like https://github.com/davidbrochart/xarray_leaflet/issues/12.

Source code

Anyway, I use xarray_leaflet temporarily:

import leafmap
import xarray as xr
import xarray_leaflet

m = leafmap.Map(center=(40, -100), zoom=4)

data = xr.open_dataset('../data/tropomi_regrid/monthly/S5P_OFFL_L2__NO2____qa50_qa75_csd_202001-202108.nc')['tropospheric_NO2_column_number_density'].isel(time=0)

l = data.leaflet.plot(m, x_dim='longitude', y_dim='latitude', colormap='vidiris')

m.add_tile_layer(l, name="TROPOMI NO2", attribution="Test")

Error:

Exception: The 'url' trait of a TileLayer instance expected a unicode string, not the LocalTileLayer LocalTileLayer(name='tropospheric_NO2_column_number_density', options=['attribution', 'detect_retina', 'max_native_zoom', 'max_zoom', 'min_native_zoom', 'min_zoom', 'no_wrap', 'tile_size', 'tms']).

Is it possible to add the LocalTileLayer to map?

@zxdawn zxdawn added the Feature Request New feature or request label Nov 5, 2021
@giswqs
Copy link
Member

giswqs commented Nov 5, 2021

Use m.add_layer() rather than m.add_tile_layer() to add LocalTileLayer. See https://ipyleaflet.readthedocs.io/en/latest/api_reference/local_tile_layer.html

Adding netCDF support is on my to-do-list. I don't have a timeline to implement it yet. Contributions are welcome.

@giswqs giswqs added the help wanted Extra attention is needed label Jan 24, 2022
giswqs added a commit that referenced this issue Mar 19, 2022
@giswqs giswqs linked a pull request Mar 20, 2022 that will close this issue
giswqs added a commit that referenced this issue Mar 20, 2022
@giswqs
Copy link
Member

giswqs commented Mar 20, 2022

@zxdawn Leafmap now supports NetCDF data. See notebook example https://leafmap.org/notebooks/52_netcdf/

@zxdawn
Copy link
Contributor Author

zxdawn commented Mar 20, 2022

@giswqs Thanks a lot for your hard work!

sthagen pushed a commit to sthagen/giswqs-leafmap that referenced this issue Feb 18, 2023
sthagen pushed a commit to sthagen/giswqs-leafmap that referenced this issue Feb 18, 2023
Added support for NetCDF opengeos#127

Former-commit-id: e450076
sthagen pushed a commit to sthagen/giswqs-leafmap that referenced this issue Jul 10, 2024
sthagen pushed a commit to sthagen/giswqs-leafmap that referenced this issue Jul 10, 2024
Added support for NetCDF opengeos#127

Former-commit-id: 37be513
kuzja111 pushed a commit to kuzja111/leafmap that referenced this issue Jul 25, 2024
kuzja111 pushed a commit to kuzja111/leafmap that referenced this issue Jul 25, 2024
Added support for NetCDF opengeos#127

Former-commit-id: 9877c9e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants