CARSv2 / cars-v2

CARSv2 project repository - public
MIT License
4 stars 2 forks source link

Julia NooB can't get 2D `DIVAnd` to run with synthetic WOD input? #3

Closed Thomas-Moore-Creative closed 11 months ago

Thomas-Moore-Creative commented 1 year ago

Hey @ChrisC28 & @croachutas,

I'm on leave until later in March and was unable to get my basic 2D DIVAnd code to run with the surface NetCDF file I generated from @ChrisC28's synthetic WOD output.

After I load the input from ../src/data/TMoore-test-input/synthetic_wod_2018_all_surface.nc I build the land mask using ../src/data/TMoore-test-input/gebco_30sec_16.nc following some simple DIVAnd workshop examples.

This is likely (my) user error as this is my first ever Julia code and I'm still finding my way. The error(s) come when I try to run the DIVAndrun command. I tried to pull apart the types and formats of the inputs thinking one of them is somehow not setup correctly for the DIVndrun function?

The notebook is here: https://github.com/CARSv2/cars-v2/blob/main/notebooks/DIVA2D-synthWOD-test.ipynb

[EDIT] To be clear there's no expectation others tackle this but any advice is welcome [EDIT]

Thanks!

croachutas commented 1 year ago

Hey Thomas, Just spotted this. Maybe try specifying epsilon2 = (0.1), i.e. tell Julia to treat epsilon2 as a tuple containing a singe Float64.

I recall a few oddities like that when I was getting the oxygen atlas working (and the error rather clearly says it can't convert a Float64 to an array of Float64s...)

croachutas commented 1 year ago

Other suggestions? Try creating pm, pn from your grid using the function DIVAnd_metric? (pm, pn should be the inverse of the grid spacing in meters, not degrees, so something of the order of (1/200,000, not 1/2)... )

Maybe try generating the mask with the DIVAnd load_mask function (https://docs.juliahub.com/DIVAnd/AaVxY/2.6.5/#DIVAnd.load_mask)?

Possibly use the output grid (as 2D arrays) from the bathy (bx, by) instead of the StepRangeLens you're currently using?

(I will note that I was using older versions of DIVAnd and Julia, so some of this advice might be obsolete).

'fraid I don't have time to download and run things myself just now as I'm running a prac this arvo.

Thomas-Moore-Creative commented 1 year ago

All very useful & helpful, thanks @croachutas

To be clear there's no expectation you do anything - thanks for the advice!

ChrisC28 commented 1 year ago

With a bit of munging I managed to get this working. I can't work out exactly what was causing @Thomas-Moore-Creative 's attempt to fall over, being a Julia noob myself.

I mainly followed this example: https://github.com/gher-uliege/Diva-Workshops/blob/master/notebooks/3-Analysis/11-L-and-epsilon-effect.ipynb

Will push my notebook as soon as I've got it somewhat tidied. CARSv2_first_pass

ChrisC28 commented 1 year ago

Updated main branch with: https://github.com/CARSv2/cars-v2/blob/main/notebooks/DIVAnd_slice_WOD_synthetic.ipynb

Thomas-Moore-Creative commented 11 months ago

@ChrisC28 has completed this.