フィルターのクリア

How do I replace -1.0000e+30 with NaN?

2 ビュー (過去 30 日間)
Simbarashe Chidzambwa
Simbarashe Chidzambwa 2022 年 11 月 9 日
コメント済み: Steven Lord 2022 年 11 月 10 日
I want to replace -1.0000e+30 in an array of SST and used the following but its not working why?:
data=netcdf.open('HadISST_sst1.nc','NC_NOWRITE')
time=netcdf.getVar(data,0);
time_bnds=netcdf.getVar(data,1);
lat=netcdf.getVar(data,2);
lon=netcdf.getVar(data,3);
sst=netcdf.getVar(data,4);
sst(sst==-1.0000*1e+30)=NaN;

採用された回答

KSSV
KSSV 2022 年 11 月 9 日
Let T be your array.
tol = -10^10 ; % fix this to satisfied value
T(T<tol) = NaN ;
  3 件のコメント
KSSV
KSSV 2022 年 11 月 9 日
Thanks is accepting/ voting the answer. :)
Simbarashe Chidzambwa
Simbarashe Chidzambwa 2022 年 11 月 9 日
Thank you very much it worked.

サインインしてコメントする。

その他の回答 (1 件)

Steven Lord
Steven Lord 2022 年 11 月 9 日
Since I'm guessing -1e30 is an outlier in your data you could use filloutliers. I'll use a slightly smaller outlier value for this example because it makes y display more nicely.
y = 1:10;
y(7) = 100
y = 1×10
1 2 3 4 5 6 100 8 9 10
y2 = filloutliers(y, NaN)
y2 = 1×10
1 2 3 4 5 6 NaN 8 9 10
  2 件のコメント
Simbarashe Chidzambwa
Simbarashe Chidzambwa 2022 年 11 月 10 日
Thank you very much Stephen, though the number represents missing values.
Steven Lord
Steven Lord 2022 年 11 月 10 日
You may be interested in standardizeMissing or fillmissing as well.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

製品


リリース

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by