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

How to create a new grid mask #85

Open
mf99274 opened this issue Mar 30, 2021 · 0 comments
Open

How to create a new grid mask #85

mf99274 opened this issue Mar 30, 2021 · 0 comments

Comments

@mf99274
Copy link

mf99274 commented Mar 30, 2021

Hi all,

I am literally new using pop_tools and running cesm2 so forgive me if this is a dumb question. I want to mask a part of the Pacific ocean and I have got to this point...

import matplotlib.colors as colors
import matplotlib.pyplot as plt
import numpy as np
import xarray as xr

import pop_tools`

## getting pop grid
grid_name = 'POP_gx1v7'
ds = pop_tools.get_grid(grid_name)
regions = np.array(np.unique(ds.REGION_MASK))

# ploting regions 
ds.REGION_MASK.plot.contourf(levels=regions, cmap='tab20');

mask3d = pop_tools.region_mask_3d(grid_name, mask_name='default')


# mask3d[4] is the pacific ocean
test = mask3d[4].copy()

test[275:283,149:151] = 0.
test[294:300,162] = 0.
test[286:292,161] = 0.

mask3d[4,:,:] = test

I know the path to the mask is ~/.pop_tools/inputdata/ocn/pop/gx1v7/grid/ . Thus, how do I save the file in .ieeei4 with my new mask?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant