Created
February 11, 2022 01:48
-
-
Save nmathewa/c4ae0e84c7ba1cab220cfe64db874f6e to your computer and use it in GitHub Desktop.
reading netcdf files (Julia)
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
using NCDataFrame | |
using NCDatasets | |
using PlotlyJS | |
using Pkg | |
using Statistics | |
using NaNStatistics | |
import NaNStatistics ; na=NaNStatistics | |
ds = NCDataset("ECMWF_ERA-40_subset.nc","r") | |
@show keys(ds) | |
temp = collect(ds["p2t"]) | |
n_temp = coalesce.(temp, NaN) | |
#nanmean(x) = mean(filter(!isnan,x),2) | |
A = [1 2; 3 4] | |
#ff = nanmean(collect(temp)) | |
dd = na.nanmean(n_temp,dims=(2,3))[:] | |
times = ds["time"][:] | |
p = scatter(y=dd,x=times) | |
layout = Layout( | |
title="Temperature Time Series", | |
xaxis_title="Date", | |
yaxis_title="Temperature(K)" | |
) | |
plot(p,layout) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment