ecmwf / earthkit-maps Goto Github PK
View Code? Open in Web Editor NEWGeospatial visulation tools and templates
License: Apache License 2.0
Geospatial visulation tools and templates
License: Apache License 2.0
When I try to visualise a grib file containing 2t with quickplot:
earthkit.maps.quickplot(ds)
it fails with:
ImportError: cf-units is required for checking unit equivalence
See above
develop
all
No response
No response
No response
To make earthkit-maps' ci work in the same way as other ECMWF packages, the following should be done:
Note: this cannot be done until the same is done for earthkit-data (ecmwf/earthkit-data#259).
Thank you!
ECMWF
I'm trying to use earthkit-maps to plot different maps for my work.
I try to initialise a chart, that I will use in the future with updated data, this way I can save some time. I try to do it with an empty array but it doesn't work.
I took a random grib file with a single grib message inside.
import cartopy.crs as ccrs
import earthkit.data
import earthkit.maps
data = earthkit.data.from_source("file", "PAROME_202404020048_diagbr.grb")
lat_lon_mesh = data.to_latlon()
lat = lat_lon_mesh["lat"]
lon = lat_lon_mesh["lon"]
data_numpy = data.to_numpy()[0]
prototype = {
"shortName": "Test",
"gridType": "regular_ll",
"latitudes": lat,
"longitudes": lon,
"values": data_numpy,
"missing_value": 9999,
}
data_prototype = earthkit.data.from_source("list-of-dicts", [prototype])
crs = ccrs.Mercator()
chart = earthkit.maps.Chart(domain="France", crs=crs)
chart.borders(linewidth=1.5)
chart.coastlines()
chart.states_provinces(color="grey")
chart.plot(data_prototype, style=style)
chart.legend()
0.0.19
CentOS8
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
File /home/mprl/bournhonesquej/dev/futurs_diags/earthkit_ttt.py:34
10 style = earthkit.maps.styles.Contour(
11 colors=[
12 "dimgray",
(...)
31 },
32 )
33 # chart.plot(data, style=style)
---> 34 chart.plot(data_prototype, lat, lon, style=style)
35 chart.legend()
36 chart.title("Diagnostic de brouillard pour zzzz", fontsize=18)
File ~/dev/venv/lib/python3.11/site-packages/earthkit/maps/charts/__init__.py:327, in Chart.plot(self, data, *args, **kwargs)
323 raise NotImplementedError(
324 "Plotting pandas DataFrames and Series is an upcoming feature"
325 )
326 else:
--> 327 return self._plot_gridded_scalar(data, *args, **kwargs)
File ~/dev/venv/lib/python3.11/site-packages/earthkit/maps/charts/__init__.py:290, in Chart._expand_rows_cols.<locals>.wrapper(self, data, *args, **kwargs)
288 else:
289 subplot = self.subplots[i]
--> 290 layer = getattr(subplot, method.__name__)(field, *args, **kwargs)
291 layers.append(layer)
293 return LayerGroup(layers)
File ~/dev/venv/lib/python3.11/site-packages/earthkit/maps/charts/subplots.py:134, in Subplot.plot_gridded_scalar.<locals>.wrapper(self, data, transform_first, style, *args, **kwargs)
131 def wrapper(self, data, *args, transform_first=None, style=None, **kwargs):
132 data = inputs.sanitise(data)
--> 134 input_data = inputs.Input(
135 data, *args, domain=self.domain, style=style, **kwargs
136 )
138 kwargs.pop("x", None)
139 kwargs.pop("y", None)
File ~/dev/venv/lib/python3.11/site-packages/earthkit/maps/inputs.py:46, in Input.__init__(self, data, x, y, transform, style, domain, **kwargs)
44 self.y = y
45 self._values = None
---> 46 self.extract(domain)
File ~/dev/venv/lib/python3.11/site-packages/earthkit/maps/inputs.py:150, in Input.extract(self, domain)
148 elif self._values is None:
149 try:
--> 150 self._values = self.data.values()
151 except AttributeError:
152 self._values = self.data
TypeError: 'numpy.ndarray' object is not callable
No response
Meteo-France
When specifying another style_library
, all default styles are no longer active. I am curious as to why this is the case?
I would have expected the default to remain active and be overwritten by the chosen library if it has specified it.
E.g.
ecmwf specified temperature but does not specify mslp.
Should than the default still be used?
I think that using default as the default to be overwritten may help.
I am prototyping a solution on my fork currently.
No response
No response
Australian Bureau of Meteorology
We can only add the map-based ones that do not require any computations.
Magics gallery: https://confluence.ecmwf.int/display/MAGP/Gallery
Magics notebooks: https://confluence.ecmwf.int/display/MAGP/Jupyter+notebooks+examples
Metview gallery: https://metview.readthedocs.io/en/latest/gen_files/gallery/index.html
ECMWF
The Style
class in earthkit-maps should have methods to convert to and from Magics styles.
Two new methods should be added to earthkit.maps.Style
:
style.to_magics_style()
Style.from_magics_style() # classmethod
No response
No response
ECMWF
As discussed in #30, it would be beneficial to alter how styles are chosen.
This implementation will use the default styles by default or use any overriden styles defined by the schema.
No response
Issue #30, was closed in reference to another pull request which had no associated issue, #29. Instead #31 implements this feature.
Australian Bureau of Meteorology
Currently the styles
directory contains default
and ecmwf
styles, which implies the inclusion of other agency or standard styles.
What would therefore be the process of adding another agencies style into earthkit-maps
?
Would it be
earthkit-maps
earthkit-maps-AGENCY
I am wondering, as I have found this tool to be exceptionally useful, and as a part of another agency, we have our own styles which I am building on my fork. How would this be included for further use?
When I install earthkit-maps from pypi with pip install earthkit-maps
I cannot import it because :
import earthkit.maps
raises:
earthkit/maps/data.py", line 54, in load
raise DataNotFoundError(f"could not find data named '{source}'")
earthkit.maps.data.DataNotFoundError: could not find data named 'domains'
See above
0.0.5
all
No response
No response
ECMWF
Due to the recent changes, the tcwv
style within the Bureau schema, is broken.
It prevents any loading of data otherwise not assigned a style.
It was originally intended to be an alias for precipitable water, but that functionality seems no longer available.
With any data except those with a defined style, create a chart using the bom
schema.
earthkit.maps.schema.use('bom')
0.0.13
Linux
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
Cell In[22], line 3
1 chart = earthkit.maps.Chart(domain = 'Oceania')
----> 2 chart.plot(ds['msl'].isel(time = 0))
File /earthkit-maps/earthkit/maps/charts/__init__.py:327, in Chart.plot(self, data, *args, **kwargs)
323 raise NotImplementedError(
324 "Plotting pandas DataFrames and Series is an upcoming feature"
325 )
326 else:
--> 327 return self._plot_gridded_scalar(data, *args, **kwargs)
File /earthkit-maps/earthkit/maps/charts/__init__.py:290, in Chart._expand_rows_cols.<locals>.wrapper(self, data, *args, **kwargs)
288 else:
289 subplot = self.subplots[i]
--> 290 layer = getattr(subplot, method.__name__)(field, *args, **kwargs)
291 layers.append(layer)
293 return LayerGroup(layers)
File /earthkit-maps/earthkit/maps/charts/subplots.py:149, in Subplot.plot_gridded_scalar.<locals>.wrapper(self, data, transform_first, style, *args, **kwargs)
142 if transform_first is None:
143 transform_first = self._can_transform_first(method)
145 mappable = method(
146 self,
147 input_data.x,
148 input_data.y,
--> 149 input_data.values,
150 style=input_data.style,
151 transform=input_data.transform,
152 transform_first=transform_first,
153 **kwargs,
154 )
156 layer = Layer(data, mappable, self, style=input_data.style)
157 self.layers.append(layer)
File /earthkit-maps/earthkit/maps/inputs.py:100, in Input.values(self)
98 @property
99 def values(self):
--> 100 return self.style.convert_units(
101 self._values,
102 self.source_units,
103 self.short_name,
104 )
File /earthkit-maps/earthkit/maps/inputs.py:95, in Input.style(self)
93 if not schema.use_preferred_styles:
94 style_units = self._kwargs.pop("units", None) or self.source_units
---> 95 self._style = styles.auto.guess_style(self.data, units=style_units)
96 return self._style
File /earthkit-maps/earthkit/maps/styles/auto.py:38, in guess_style(data, units)
35 with open(fname, "r") as f:
36 config = yaml.load(f, Loader=yaml.SafeLoader)
---> 38 for criteria in config["criteria"]:
39 for key, value in criteria.items():
40 if data.metadata(key, default=None) != value:
KeyError: 'criteria'
### Accompanying data
_No response_
### Organisation
Australian Bureau of Meteorology
earthkit-maps is targetting a wide range of users, including:
earthkit-maps should have multiple sources for styles, which can be selected with a switch in the schema
. There should also possibly be a switch like "automatically_convert_units", allowing users to switch on/off automatic unit conversion.
No response
No response
No response
If I use this code (develop branch):
import earthkit.data
from earthkit.maps.quickplot import quickplot
earthkit.data.download_example_file("test.grib")
data = earthkit.data.from_source("file", "test.grib")
quickplot(data)
I get this plot in a notebook:
See above
develop
macOS
No response
No response
ECMWF
At present, there is no way to specify a different colour to use for NaN values in earthkit.maps.styles.Style.values_to_colors. This should be added to allow more complex colour schemes to work with polygon plotting.
No response
No response
No response
No response
When I install earthkit-maps from pypi with pip install earthkit-maps
I cannot import it because cv2
is not found:
import earthkit.maps
...
E ModuleNotFoundError: No module named 'cv2'
See above
0.0.1
macOS
No response
No response
No response
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.