-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
443 additions
and
292 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Created on 2023.06.11 | ||
@author: MiniUFO | ||
Copyright 2018. All rights reserved. Use is subject to license terms. | ||
""" | ||
#%% test objective analysis method | ||
import numpy as np | ||
import xarray as xr | ||
from xgrads import oacressman | ||
|
||
|
||
def test_oacressman(): | ||
ds = xr.open_dataset('./ctls/stationPrecip.nc') | ||
|
||
lonV = np.linspace(70, 140, 141) | ||
latV = np.linspace(15, 55, 81) | ||
|
||
lon = xr.DataArray(lonV, dims='lon', coords={'lon': lonV}) | ||
lat = xr.DataArray(latV, dims='lat', coords={'lat': latV}) | ||
|
||
precip = xr.where(np.isnan(ds.precip), 0, ds.precip).load() | ||
|
||
res1, wei1 = oacressman(precip, ds.lons, ds.lats, 'stnID', | ||
lon, lat, rads=[4], method='cressman') | ||
res2, wei2 = oacressman(precip, ds.lons, ds.lats, 'stnID', | ||
lon, lat, rads=[4], method='exp') | ||
|
||
assert res1.shape == res2.shape == (31, 81, 141) | ||
assert wei1.shape == wei2.shape == (31, 81, 141) | ||
|
||
|
||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.