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

mask is not applied to output NetCDF file if remove_mean = false #24

Open
Alexander-Barth opened this issue Apr 18, 2024 · 3 comments
Open

Comments

@Alexander-Barth
Copy link
Member

Describe the bug
mask is not applied to output NetCDF file if remove_mean = false

To Reproduce

using Test
using DINCAE
using Base.Iterators
using Random
using NCDatasets
using CUDA

const F = Float32
Atype =
    if CUDA.functional()
        CuArray{F}
    else
        Array{F}
    end

Random.seed!(123)

filename = "/home/abarth/Downloads/ds_test.nc"

data = [
    (filename = filename,
     varname = "CHL",
#     varname = "DINO",
     obs_err_std = 1,
     jitter_std = 0.05,
     isoutput = true,
     ),
    (filename = filename,
#     varname = "CHL",
     varname = "DINO",
     obs_err_std = 1,
     jitter_std = 0.05,
     isoutput = true,
     )

]
data_test = data;
data_all = [data,data_test]

epochs = 3
batch_size = 5
save_each = 10
skipconnections = [1,2]
enc_nfilter_internal = round.(Int,32 * 2 .^ (0:3))
clip_grad = 5.0
regularization_L2_beta = 0
save_epochs = [epochs]
is3D = false
ntime_win = 3

(upsampling_method,is3D,truth_uncertain,loss_weights_refine) = (:nearest, false,false, (1.,))


fnames_rec = ["ehsan_out.nc"]
paramfile = "ehsan_params.nc"

losses = DINCAE.reconstruct(
    Atype,data_all,fnames_rec;
    epochs = epochs,
    batch_size = batch_size,
    truth_uncertain = truth_uncertain,
    enc_nfilter_internal = enc_nfilter_internal,
    clip_grad = clip_grad,
    save_epochs = save_epochs,
    is3D = is3D,
    upsampling_method = upsampling_method,
    ntime_win = ntime_win,
    loss_weights_refine = loss_weights_refine,
    paramfile = paramfile,
    remove_mean = false,
)


ds = NCDataset(fnames_rec[1])
lon = ds["lon"][:]
lat = ds["lat"][:]
data = nomissing(ds["DINO"][:,:,1],NaN) # change missing to NaN

# plot the first time instant
using PyPlot # you can use python directly of course
pcolor(lon,lat,data')
savefig("/tmp/ehsan.png")

Expected behavior

Spain (and others) should be masked.

Environment

  • DINCAE version

bdc9c94

Full output

(no error)

CC @EhsanMehdipour

@Alexander-Barth
Copy link
Member Author

@EhsanMehdipour does the current fix work for you? (in any case, the output of the values on sea are still ok).

@EhsanMehdipour
Copy link

updating the repository and packages fixed the issue for the test dataset.

@EhsanMehdipour
Copy link

to ensure that the CUDA toolkit is working on the HPC system, I had to set the CUDA runtime version by CUDA.set_runtime_version!(v"12.1.1")

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

No branches or pull requests

2 participants