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

pymagicc.run of MAGICC7 isn't generating dat_*.out #338

Open
safiume opened this issue May 17, 2022 · 3 comments
Open

pymagicc.run of MAGICC7 isn't generating dat_*.out #338

safiume opened this issue May 17, 2022 · 3 comments

Comments

@safiume
Copy link

safiume commented May 17, 2022

Describe the bug
Initial tests of magicc7 are failing. pymagicc.run running wine or wine64 crashes with a page fault on read access.
If I try to set out_concentrations, or out_temperature or out_forcing magicc crashes.

I can disable "out_concentrations" : 1, and parameters.out does successfully get written to disk, however, there are nonprintable characters also being written.

I'm creating a MAGICCData object of SSP245_EMMS.SCEN7 then having pymagicc.run run that verbosely and write out either temperature and parameters.out or just parameters.out.

Failing Test
pymagicc.run -> wine64, magicc.exe

Expected behavior

Valid Magiccdata/openscm of the calculated model output from SSP245, from SSP245_EMMS.SCEN7.

Screenshots

The full output of jupyter notebook cells is here
I've uploaded PARAMETERS.OUT for this failure.

System:
MacOS 10.13.6
python 3.7.4 (v3.7.4:e09359112e, Jul 8 2019, 14:54:52)
pymagicc 2.1.3

For debugging, I changed core.py to run wine64 binary when running version 7.

CalledProcessError: Command '['wine64', '/var/folders/w3/f4nkvkvd3b37ylsg3t44w6cw0000gn/T/pymagicc-4dfaf3l8/run/magicc.exe', '--verbose']' returned non-zero exit status 5.
Additional context
With pymagicc 2.1.3 I'm able to get valid magicc6 output.
image

I did notice the msdos \r\n weren't included in the main MAG*CFG files.

@lewisjared
Copy link
Collaborator

Thanks for the bug report and useful debugging information. We haven't tested running the MAGICC7 binary via wine on Mac and are working on an updated release that also contains a native Mac binary which should hopefully resolve this. It appears that wine is more pedantic about memory access compared to Windows.

Let's try to use the out_dynamic_vars parameter to explicitly set what output is written to disk. Could you please update your code to use the following snippet.

with MAGICC7(root_dir="../pymagicc/MAGICC7") as magic
    magicc.set_output_variables(
        write_ascii=True,
    )
    s24 = pymagicc.run(s245, magicc_version=7, debug='verbose', out_dynamic_vars=["DAT_SURFACE_TEMP"], **cfg)

Are you able to run your example on a Windows machine?

@debibooo
Copy link

Hello, have you solved your problem? I met a similar bug on a Windows machine when I tried to run magic7.exe
I first set %env MAGICC_EXECUTABLE_7=../../magicc/run/magicc7.exe and directly run results = pymagicc.run(rcp26, magicc_version=7, debug='verbose',out_dynamic_vars=["DAT_SURFACE_TEMP"]). The error shows as :
Command '['C:\\Users\\PC\\AppData\\Local\\Temp\\pymagicc-1zh_r7mm\\run\\magicc7.exe', '--verbose']' returned non-zero exit status 32.
Anyone could provide advice? Thanks much!

@safiume
Copy link
Author

safiume commented Nov 24, 2022

Forcing out_dynamic_vars=["DAT_SURFACE_TEMP"] still errors:
https://gist.github.com/safiume/09dcd42a6934dc1c9410242cd5700f0a?short_path=f19329f,
Github truncates the output of cell eight in the rendered notebook, see the raw or source blob.

I also tried forcing out_dynamic_vars=["DAT_SURFACE_TEMP", "DAT_CO2_CONC"] which errors as well:
https://gist.github.com/safiume/702cc58a73a5ccec577048e24df2de53?short_path=d1cf31f,

These runs did write out the ../out/PARAMETERS.OUT file.

For these tests I switched the binary back to plain wine (wine Mach-O executable i386) and
wine --version
wine-3.0.2

Windows has a different error, on windows 10, even when setting it to run in compatibility mode for windows 8, it errors with
image

Has the download binary been updated since mid May?

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

3 participants