Open MiNeEU opened 1 year ago
Hi @MiNeEU,
Many thanks for the report. I can confirm that we do not support the direct cropping of these Lambert Conformal grids. You do have a couple of options though, depending on what you want to do with the data next.
1) You can change the grid to be regular lat/lon within that read command, e.g.
f = mv.read(data=f, area=[47,15,50,23], grid=[0.1,0.1])
This will crop and interpolate onto the regular grid in one step. Your data will now be on a regular grid - the finer the grid you choose (I used 0.1 degrees in this example, but you can change it), the closer it will be to the original data.
2) You could convert to Geopoints if you don't mind the data becoming 'scattered' points. e.g.
geo = mv.grib_to_geo(geopoints_format = "x_y_v", data = f)
inside_mask = geo.mask([47,15,50,23])
inside = geo.filter(inside_mask)
I hope this helps!
Cheers, Iain
Hi Iain, many thanks for your quick replay. I go to try it. Have a great day. Kind regards Michal Nestiak, NWP SHMU
On Fri, 6 Oct 2023, 13:07 Iain Russell, @.***> wrote:
Hi @MiNeEU https://github.com/MiNeEU,
Many thanks for the report. I can confirm that we do not support the direct cropping of these Lambert Conformal grids. You do have a couple of options though, depending on what you want to do with the data next.
- You can change the grid to be regular lat/lon within that read command, e.g.
f = mv.read(data=f, area=[47,15,50,23], grid=[0.1,0.1])
This will crop and interpolate onto the regular grid in one step. Your data will now be on a regular grid - the finer the grid you choose (I used 0.1 degrees in this example, but you can change it), the closer it will be to the original data.
- You could convert to Geopoints if you don't mind the data becoming 'scattered' points. e.g.
geo = mv.grib_to_geo(geopoints_format = "x_y_v", data = f) inside_mask = geo.mask([47,15,50,23]) inside = geo.filter(inside_mask)
I hope this helps!
Cheers, Iain
— Reply to this email directly, view it on GitHub https://github.com/ecmwf/metview-python/issues/52#issuecomment-1750419944, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTJVZ3P4KY7OKQC6XVFN7DX57Q5XAVCNFSM6AAAAAA5UAHRH2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONJQGQYTSOJUGQ . You are receiving this because you were mentioned.Message ID: @.***>
What happened?
When I try to process grb in Lambert it is not possible to crop it
CLSTEMPERATURE_00.grb
filename = 'CLSTEMPERATURE_00.grb' f = mv.read(filename) f = mv.read(data=f, area=[47,15,50,23])
Is it possible to implement it? Thanks
Python - ERROR - 20231005.095534 - Line 0 in 'PythonScript': Exception: Serious Bug: Representation::croppedRepresentation() not implemented for RegularGrid[x=LocalConfiguration[root={type => linear , start => -1.28924e+06 , end => 1.23076e+06 , N => 561 , endpoint => true}],y=LocalConfiguration[root={type => linear , start => -827936 , end => 1.14306e+06 , N => 439 , endpoint => true}],projection=LocalConfiguration[root={type => lambert_conformal_conic , longitude0 => 17 , latitude0 => 46.244 , latitude1 => 46.244 , latitude2 => 46.244}],firstPointBottomLeft=0,bbox=BoundingBox[north=56.4659,west=-3.18266,south=37.759,east=36.3038]] Python - ERROR - 20231005.095534 - Line 0 in 'PythonScript': MIR: Serious Bug: Representation::croppedRepresentation() not implemented for RegularGrid[x=LocalConfiguration[root={type => linear , start => -1.28924e+06 , end => 1.23076e+06 , N => 561 , endpoint => true}],y=LocalConfiguration[root={type => linear , start => -827936 , end => 1.14306e+06 , N => 439 , endpoint => true}],projection=LocalConfiguration[root={type => lambert_conformal_conic , longitude0 => 17 , latitude0 => 46.244 , latitude1 => 46.244 , latitude2 => 46.244}],firstPointBottomLeft=0,bbox=BoundingBox[north=56.4659,west=-3.18266,south=37.759,east=36.3038]] Python - ERROR - 20231005.095534 - Line 0 in 'PythonScript': Interpolation failed (-2) Python - ERROR - 20231005.095534 - Line 0 in 'PythonScript': Retrieve-> Error code: -2 Traceback (most recent call last):
What are the steps to reproduce the bug?
When I try to process grb in Lambert it is not possible to crop it
CLSTEMPERATURE_00.grb
filename = 'CLSTEMPERATURE_00.grb' f = mv.read(filename) f = mv.read(data=f, area=[47,15,50,23])
Is it possible to implement it? Thanks
Version
1.15.0
Platform (OS and architecture)
Linux x86_64
Relevant log output
Accompanying data
https://aladin.nowcasting.eu/shmu/alaro/oper/CLSTEMPERATURE_00.grb
Organisation
SHMU