diff --git a/src/BiasCorrection/QDM.jl b/src/BiasCorrection/QDM.jl index 69f82b1..a79600f 100644 --- a/src/BiasCorrection/QDM.jl +++ b/src/BiasCorrection/QDM.jl @@ -1,3 +1,4 @@ +# > 测试如何做偏差矫正更有效,时间序列可能出现不连续的现象 using StatsBase: ecdf, quantile diff --git a/src/nc_info.jl b/src/nc_info.jl index f228f22..2f334f0 100644 --- a/src/nc_info.jl +++ b/src/nc_info.jl @@ -42,8 +42,8 @@ function nc_bands(ds::NCdata) # v_id = NCDatasets.nc_inq_varids(ds.ncid) # vars = NCDatasets.nc_inq_varname.(ds.ncid, v_id) vars = keys(ds) - dims = ["lon", "long", "longitude", - "lat", "latitude", + dims = ["x", "lon", "long", "longitude", + "y", "lat", "latitude", "lev", "level", "mlev", "plev", "height", "crs", diff --git a/src/utilize/nc_aggregate.jl b/src/utilize/nc_aggregate.jl index a8d11ba..735ed3a 100644 --- a/src/utilize/nc_aggregate.jl +++ b/src/utilize/nc_aggregate.jl @@ -8,8 +8,8 @@ $(METHODLIST) """ -function nc_aggregate(f::AbstractString, fout=nothing; by="year", fun=nanmean, - outdir=".", overwrite=false, verbose=true) +function nc_aggregate(f::AbstractString, fout=nothing; by="year", fun=mean, + outdir="./OUTPUT", overwrite=false, verbose=true) fout === nothing && (fout = "$outdir/$(basename(f))") if isfile(fout) && !overwrite @@ -42,7 +42,7 @@ function nc_aggregate(f::AbstractString, fout=nothing; by="year", fun=nanmean, printstyled("Writing data...\n") @time nc_write(fout, band, vals, dims, Dict(nc[band].attrib); - compress=0, goal_attrib=Dict(nc.attrib)) + compress=0, global_attrib=Dict(nc.attrib)) nc_close(nc) end @@ -58,15 +58,16 @@ scenario = "historical" indir = "Z:/ChinaHW/CMIP6_cluster_HItasmax_adjchunk/HI_tasmax/historical" outdir = "Z:/ChinaHW/CMIP6_cluster_HItasmax_adjchunk/HI_tasmax_year/historical" -nc_aggregate_dir(indir; by="year", outdir) +nc_aggregate_dir(indir; by="year", replacement="day"=>"year", outdir) ``` $(METHODLIST) """ function nc_aggregate_dir(indir; - by="year", replacement="day"=>by, outdir=".", kw...) + by="year", replacement="day"=>by, outdir="./OUTPUT", kw...) fs = dir(indir, "nc\$") + check_dir(outdir) for f in fs file = str_replace(basename(f), replacement[1], replacement[2]) diff --git a/src/utilize/nc_combine.jl b/src/utilize/nc_combine.jl index 2d8261c..d9bfa10 100644 --- a/src/utilize/nc_combine.jl +++ b/src/utilize/nc_combine.jl @@ -43,7 +43,7 @@ function nc_combine(fs, fout; compress=0) printstyled("Writing data...\n") @time nc_write(fout, band, vals, dims, Dict(v.attrib); - compress, goal_attrib=Dict(nc.attrib)) + compress, global_attrib=Dict(nc.attrib)) end """ diff --git a/src/utilize/nc_subset.jl b/src/utilize/nc_subset.jl index 77638c7..9ed386c 100644 --- a/src/utilize/nc_subset.jl +++ b/src/utilize/nc_subset.jl @@ -92,7 +92,7 @@ function nc_subset(f, range::Vector, fout=nothing; printstyled("Writing data...\n") @time nc_write(fout, band, vals, dims, Dict(v.attrib); - compress=1, goal_attrib=Dict(nc.attrib)) + compress=1, global_attrib=Dict(nc.attrib)) # ncatt_put(fout, Dict(nc.attrib)) end