Skip to content

Issue overlapping model data to Google map background #239

@alessandroanav

Description

@alessandroanav

Hello,

I would overlap my model data to Google map using salem but I am facing an issue when I use data on its original grid. However, if I regrid data to WRF grid the program works perfectly, so I do not understand why on the native grid the script doesn't work. Any help to understand if I am doing something wrong or there is a bug in the code is greatly appreciated.

Please find below the relevant code.

I open and read the netcdf data with xr.open_dataset, which returns:

Dimensions: (time: 1, lon: 4320, lat: 2160)
Coordinates:

  • time (time) datetime64[ns] 8B 2023-06-10
  • lon (lon) float32 17kB -180.0 -179.9 -179.8 ... 179.8 179.9 180.0
  • lat (lat) float32 9kB 89.96 89.88 89.79 89.71 ... -89.79 -89.88 -89.96
    Data variables:
    fldout (time, lat, lon) float32 37MB ...

To check if data are recognized correctly by salem, I make a quick map with salem.quick_map(varname="fldout"). As data are displayed correctly, I assume salem recognizes the model grid.

Model_data
Then, I download the google map over a region of interest:

g                     = GoogleVisibleMap([0, 20.0], y=[20, 60]],
                                         scale=2,  
                                         maptype='satellite',use_cache=True)  

and transform model grid to the new map, as suggested in this script (https://salem.readthedocs.io/en/v0.3.4/auto_examples/plot_googlestatic.html):

sm                    = Map(g.grid, factor=1, countries=False)
x, y                  = sm.grid.transform(lon, lat)

At the end I try to overlap the data to the google map but, as you can see, the model grid does not match the google map.

Model_on_google_map

Any insight of this problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions