Error with create_forcing.m

Hi everyone! I’m learning how to work with CROCO now, and I am facing a problem about how to create a forcing file in 360 days rather than 12 months.

The code runs well in the scale of 12 mouths, while returns warning “## close failed: G:\JS\croco_files\” in the scale of 360 days. The result is that I can’t write my datas into the empty file next step. And if I comment out part of the code to reduce variables such as ‘sustr’,‘svstr’ , the create_forcing.m will work well again. What’s wrong with it? And how can I solve it?

Thanks for any useful help.


*( a file changing from create_forcing.m tha can run directly is following)


It seems to me a memory issue with Matlab.

I’ve tried the file attached below and it works fine if I increase the gradually the value of


(lines 34-36)

but when I try to increase

sst_time to 360 it gives me

Warning: ## close failed: C:\Users\dgeo\croco_tools\
In netcdf/close (line 20)
In create_forcing_mengx (line 182)

and Matlab crashes, every time.

I can only increase the value of three dimensions at a time.

Hope this helps



Thanks for your help. That maybe a choice. There still have a question that a, even larger than the frc file, can produce successfully at the same time. It makes me confused.

You try to do separate files, with three different variables each and then join them into one using NCO tools. It’s a dirty trick but it might work…

I got it. Thanks for your advising.

It’s a question with format of NetCDF. NetCDF-3 have a limit that can larger than 2G. So, change the format to NetCDF-4 can solve the question.

But I don’t know how to do it in the preprocessing code of CROCO. As a substitude of file ‘create_forcing.m’, I write down a similar code. You can run the code according to your case first. Then run the code ‘make_forcing.m’ by commenting out the part of ‘Create the forcing file’.