ERA52ARL code compilation error

Post any questions or comments regarding the Mac OS X version of HYSPLIT. This includes the model execution, GUIs, results, or graphics. Be sure to mention the version of OS you are using.
seethala.chellappan
Posts: 11
Joined: April 21st, 2021, 11:47 am
Registered HYSPLIT User: Yes

ERA52ARL code compilation error

Post by seethala.chellappan »

I am trying to work with the Mac version of HYSPLIT and facing some issues. My main intention is to run the trajectory model with inputs from ERA5 and MERRA2. Unlike the Linux version, the Mac version of HYSPLIT doesn't come with precompiled ERA5 and MERRA2 data converter executives. So, I am trying to compile the ERA5 converter code available at data2arl/era52arl but running into an issue. Looks like a linking issue, I tried deleting the Hysplit directory and install everything back and checked, the issue still there. Could you please help me to resolve this issue, shown below? I appreciate any help you may provide. Thank you.

seethalachellappan@Seethalas-MacBook-Air-2 era52arl % gfortran era52arl.f90 -o era52arl.exe -I/opt/homebrew/Cellar/eccodes/2.22.0/include -L/opt/homebrew/Cellar/eccodes/2.22.0/lib
ld: warning: dylib (/opt/homebrew/Cellar/gcc/11.1.0_1/lib/gcc/11/libgfortran.dylib) was built for newer macOS version (11.3) than being linked (11.2)
Undefined symbols for architecture arm64:
"___grib_api_MOD_grib_close_file", referenced from:
_MAIN__ in cctb9jIx.o
"___grib_api_MOD_grib_count_in_file", referenced from:
_MAIN__ in cctb9jIx.o
"___grib_api_MOD_grib_get_error_string", referenced from:
_MAIN__ in cctb9jIx.o
"___grib_api_MOD_grib_get_int", referenced from:
_MAIN__ in cctb9jIx.o
"___grib_api_MOD_grib_get_real4", referenced from:
_MAIN__ in cctb9jIx.o
"___grib_api_MOD_grib_get_real4_array", referenced from:
_MAIN__ in cctb9jIx.o
"___grib_api_MOD_grib_get_size_int", referenced from:
_MAIN__ in cctb9jIx.o
"___grib_api_MOD_grib_get_string", referenced from:
_MAIN__ in cctb9jIx.o
"___grib_api_MOD_grib_multi_support_on", referenced from:
_MAIN__ in cctb9jIx.o
"___grib_api_MOD_grib_new_from_file", referenced from:
_MAIN__ in cctb9jIx.o
"___grib_api_MOD_grib_open_file", referenced from:
_MAIN__ in cctb9jIx.o
"___grib_api_MOD_grib_release", referenced from:
_MAIN__ in cctb9jIx.o
"_pakinp_", referenced from:
_MAIN__ in cctb9jIx.o
"_pakndx_", referenced from:
_MAIN__ in cctb9jIx.o
"_pakrec_", referenced from:
_MAIN__ in cctb9jIx.o
"_pakset_", referenced from:
_MAIN__ in cctb9jIx.o
ld: symbol(s) not found for architecture arm64
collect2: error: ld returned 1 exit status
seethalachellappan@Seethalas-MacBook-Air-2 era52arl %
sonny.zinn
Posts: 354
Joined: May 8th, 2019, 1:31 pm
Registered HYSPLIT User: Yes

Re: ERA52ARL code compilation error

Post by sonny.zinn »

Your gfortran command is incomplete. The -L option points to where library files are located but it does not specify the names of library files to be linked. You will need to add, for example, "-leecodes_f90 -leecodes". Also "-L../../library -lhysplit" needs to be there for linking with the HYSPLIT library.

The HYSPLIT library is compiled for x86_64 CPU. Your computer has an ARM64 CPU. Linking mixed target binaries may or may not work.
seethala.chellappan
Posts: 11
Joined: April 21st, 2021, 11:47 am
Registered HYSPLIT User: Yes

Re: ERA52ARL code compilation error

Post by seethala.chellappan »

Hi Sonny,
Thank you! Do you know how I can handle hysplit library in a precompiled version? Following your suggestion, I executed "gfortran era52arl.f90 -o era52arl.exe -I/opt/homebrew/Cellar/eccodes/2.22.0/include -L/opt/homebrew/Cellar/eccodes/2.22.0/lib -leccodes_f90 -leccodes", but not included hysplit library loc, and end up of having the below lines. Very much possible this is due to the Mac ARM64 architecture. Thanks for any clues to address this you may have.

ld: warning: dylib (/opt/homebrew/Cellar/eccodes/2.22.0/lib/libeccodes_f90.dylib) was built for newer macOS version (11.3) than being linked (11.2)
ld: warning: dylib (/opt/homebrew/Cellar/gcc/11.1.0_1/lib/gcc/11/libgfortran.dylib) was built for newer macOS version (11.3) than being linked (11.2)
Undefined symbols for architecture arm64:
"_pakinp_", referenced from:
_MAIN__ in ccdekzY8.o
"_pakndx_", referenced from:
_MAIN__ in ccdekzY8.o
"_pakrec_", referenced from:
_MAIN__ in ccdekzY8.o
"_pakset_", referenced from:
_MAIN__ in ccdekzY8.o
ld: symbol(s) not found for architecture arm64
collect2: error: ld returned 1 exit status
sonny.zinn
Posts: 354
Joined: May 8th, 2019, 1:31 pm
Registered HYSPLIT User: Yes

Re: ERA52ARL code compilation error

Post by sonny.zinn »

I realized that the HYSPLIT distribution for macOS does not contain the libhysplit.a file. The missing subroutines pakinp, pakndx, etc. are in the HYSPLIT library file. I will contact you via email.
seethala.chellappan
Posts: 11
Joined: April 21st, 2021, 11:47 am
Registered HYSPLIT User: Yes

Re: ERA52ARL code compilation error

Post by seethala.chellappan »

Hi Sonny, Thank you very much! I received the email. I am going to work with those files and keep you updated about how it goes.
seethala.chellappan
Posts: 11
Joined: April 21st, 2021, 11:47 am
Registered HYSPLIT User: Yes

Re: ERA52ARL code compilation error

Post by seethala.chellappan »

Hi Sonny,
The executables are working now. Thank you!

One quick question. The automatic trajectories plots are interesting, but what I really need is to get the lat/lon tracks and corresponding met data., i.e., to read the files 'tdump' and 'cdump'. I can write my own code to read, but I think it is already in the python package. I had a quick look at the programs and got lost. Could you please point me, which python code reads tdump/cdump file? Thank you very much in advance.

Best regards,
Seethala
sonny.zinn
Posts: 354
Joined: May 8th, 2019, 1:31 pm
Registered HYSPLIT User: Yes

Re: ERA52ARL code compilation error

Post by sonny.zinn »

Files in python/hysplitdata can be used to read trajectory dumps and concentration dumps.
seethala.chellappan
Posts: 11
Joined: April 21st, 2021, 11:47 am
Registered HYSPLIT User: Yes

Re: ERA52ARL code compilation error

Post by seethala.chellappan »

Hi Sonny,
I have tried using your 'era52arl' executable provided by you. It didn't show any error for executing it without inputs. But, with inputs, I get the following error. I can see the error is 'eccodes' path, as the executable was created in your computer. Is there any workaround for this issue? Thank you and looking forward to hearing from you.

(base) seethalachellappan@Seethalas-Air-2 exec % ./era52arl -dera52arl.cfg -i../python/ERA5_2000.Jan01.3dpl.grib -a../python/ERA5_2000.Jan01.2dpl.all.grib -t1 -oera5data.arl
Existing decoding configuration: era52arl.cfg
ECCODES ERROR : Unable to find boot.def. Context path=/Users/sonny.zinn/local_ifort/share/eccodes/definitions

Possible causes:
- The software is not correctly installed
- The environment variable ECCODES_DEFINITION_PATH is defined but incorrect

ecCodes assertion failed: `0' in /Users/sonny.zinn/eccodes-2.17.0-Source/src/grib_context.c:226
forrtl: error (76): Abort trap signal
Image PC Routine Line Source
era52arl 000000010024912A for__signal_handl Unknown Unknown
libsystem_platfor 00007FFF20366D7D _sigtramp Unknown Unknown
zsh: abort ./era52arl -dera52arl.cfg -i../python/ERA5_2000.Jan01.3dpl.grib -t1
(base) seethalachellappan@Seethalas-Air-2 exec %

Best regards,
Seethala
seethala.chellappan
Posts: 11
Joined: April 21st, 2021, 11:47 am
Registered HYSPLIT User: Yes

Re: ERA52ARL code compilation error

Post by seethala.chellappan »

Hello Sonny,
Thank you for the era52arl Mac executables. Initially, I had an error with eccodes definition path, that I have resolved now.

But, I am getting the following error now. Also attached the era52arl.cfg file content at the bottom. Hopefully, you can help me resolve this issue soon?

% ./era52arl -i../working/ERA5_2010.Feb07.3dpl.grib -a../working/ERA5_2010.Feb07.2dpl.all.grib -t1 -oera52arl.arl

Existing decoding configuration: era52arl.cfg
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image PC Routine Line Source
era52arl 0000000104F37144 for__signal_handl Unknown Unknown
libsystem_platfor 00007FFF20366D7D _sigtramp Unknown Unknown
era52arl 0000000104E5D0A1 grib_accessor_fac Unknown Unknown
era52arl 0000000104E3D6C1 create_accessor Unknown Unknown
era52arl 0000000104E4086E create_accessor Unknown Unknown
era52arl 0000000104E4086E create_accessor Unknown Unknown
era52arl 0000000104E3DBBE create_accessor Unknown Unknown
era52arl 0000000104ED5AFE grib_handle_creat Unknown Unknown
era52arl 0000000104ED5768 grib_handle_new_f Unknown Unknown
era52arl 0000000104ED67DE grib_new_from_fil Unknown Unknown
era52arl 0000000104EDB335 grib_count_in_fil Unknown Unknown
era52arl 0000000104E33F50 grib_api_mp_grib_ Unknown Unknown
era52arl 0000000104E17B51 MAIN__ Unknown Unknown
era52arl 0000000104E1552E main Unknown Unknown

era52arl.cfg file content:-

&SETUP
numatm = 6,
atmgrb = 'z','t','u','v','w','r',
atmcat = 129 , 130 , 131 , 132 , 135 , 157 ,
atmnum = 129 , 130 , 131 , 132 , 135 , 157 ,
atmcnv = 0.102 , 1.0 , 1.0 , 1.0 , 0.01, 1.0 ,
atmarl = 'HGTS','TEMP','UWND','VWND','WWND','RELH',
numsfc = 14,
sfcgrb = '2t','10v','10u','tcc','sp','2d','blh','cape','z','tp','sshf','ssrd','slhf','zust',
sfccat = 167, 166, 165, 164, 134, 168, 159, 59, 129, 228, 146, 169, 147, 3
sfcnum = 167, 166, 165, 164, 134, 168, 159, 59, 129, 228, 146, 169, 147, 3
sfccnv = 1.0, 1.0, 1.0, 1.0, 0.01 ,1.0, 1.0, 1.0 ,0.102, 1.0, 0.00028, 0.00028, 0.00028, 1.0
sfcarl = 'T02M','V10M','U10M','TCLD','PRSS','DP2M','PBLH','CAPE','SHGT','TPP1','SHTF','DSWF','LTHF','USTR',
numlev = 37
plev = 1000, 975, 950, 925, 900, 875, 850, 825, 800, 775, 750, 700, 650, 600, 550, 500, 450, 400, 350, 300, 250, 225, 200, 175, 150, 125, 100, 70, 50, 30, 20, 10, 7, 5, 3, 2, 1
/
~
~


Best regards,
Seethala
alicec
Posts: 411
Joined: February 8th, 2016, 12:56 pm
Registered HYSPLIT User: Yes

Re: ERA52ARL code compilation error

Post by alicec »

Segmentation faults can be hard to diagnose. Can you answer the following

1. Can you just run the executable for era52arl with no inputs?

2. Is an ERA52ARL.MESSAGE file being created? If so can you include the contents?

3. can you remove the era52arl.cfg file and try running without it. (era52arl will generate a default if it is not present).
I don't think it is a problem with the cfg file.

4. check your grib files with the eccodes grib_dump utility or other.
Post Reply

Return to “HYSPLIT for Mac OS X”