CARTAvis / carta-backend

Source code repository for the backend component of CARTA, a new visualization tool designed for the ALMA, the VLA and the SKA pathfinders.
https://cartavis.github.io/
GNU General Public License v3.0
22 stars 11 forks source link

auto update casa measure data #961

Closed kswang1029 closed 2 years ago

kswang1029 commented 3 years ago

based on https://casa.nrao.edu/casadocs/casa-6.1.0/external-data/casa-data-repository it is suggested to update casa measure data regularly. The above URL contains the information on how to get it updated.

kswang1029 commented 3 years ago

I suggest @ajm-asiaa and one backend developer to work together on this.

jolopezl commented 2 years ago

Some work log for the implementation details:

After a quick conversation with @ajm-asiaa to help me understand the build and packaging to CARTA, we think a reasonable approach could be to update the data using a bash script and let the CASA data reside in $HOME/.carta/casa-data. Then, we can add something to the CARTA start script in scripts/carta and call for a data update, depending on the parameters provided (could be carta --update-casa-data) or something else, for instance, periodically.

@veggiesaurus, as you pointed out too: casa-data needs to reside in $HOME/.carta/data optionally. So, it should first look in the home dir and then fall back to the usual place (e.g. /usr/share/casacore/data).

ajm-ska commented 2 years ago

It seems that unless we modify carta-casacore, we will need to use the -DDATA_DIR="%CASAROOT%" carta-casacore cmake build flag and then call export CASAPATH= before starting CARTA.

I guess a bash startup script could check for the presence of the 'geodetic' folder in $HOME/.carta/casa-data first and if present run export CASAPATH=$HOME/.carta/casa-data, if not present then run export CASAPATH=/usr/share/casacore/data.

I did a few experiments to see how that could be improved.

I tried adding two search paths to -DDATA_DIR. e.g. -DDATA_DIR=~/.carta/casa-data:/usr/local/share/casacore/data although I know the first problem is it would lock it to my $HOME and not keep it as a variable to work on other systems. But either way, it doesn't work as it only looks in the first path and ignores the second. Adding two paths to the export CASAPATH= does not work either.

I should mention that if we use -DDATA_DIR="%CASAROOT%" then that hard-codes in CASAROOT to the carta-casacore build path. For example, if I run export CASAPATH=/usr/local/share/casacore/data and then start the carta_backend, the error is:

WARN    MeasIERS::findTab (file /Users/ajm/carta-casacore/casa6/casatools/casacore/measures/Measures/MeasIERS.cc, line 387)+/Users/ajm/carta-casacore/build/usr/share/casacore/data/geodetic/

So we need to back out of the directory structure by adding ../../../../ e.g. export CASAPATH=../../../../usr/local/share/casacore/data.

You may be wondering, why not just build carta-casacore with -DDATA_DIR="/"? I tried it and it does not work. It appears we need to use %CASAROOT% in order for export CASAPATH to have any affect.

%CASAHOME% is another variable in the code, but that seems to point towards $HOME/aips++ on top of CASAROOT. e.g.:

WARN    MeasIERS::findTab (file /Users/ajm/carta-casacore/casa6/casatools/casacore/measures/Measures/MeasIERS.cc, line 387)+/Users/ajm/carta-casacore/build/Users/ajm/aips++/data/geodetic/

Now that I have looked at this closely, a loop in a bash script would be the easiest option, but maybe modifying our carta-casacore would be the more elegant solution? At least to get rid of the need to have ../../../../ while CASAPATH option is enabled?

jolopezl commented 2 years ago

@ajm-asiaa, so we should add the following:

ajm-ska commented 2 years ago

A few points on https://github.com/CARTAvis/carta-backend/pull/1008/commits/6efae983617b166e8417c5761351adab25f666fa

confluence commented 2 years ago

For beta releases, can the user manually create the appropriate files in .carta (and symlink them to .carta-beta if necessary)?

This should be documented. I don't think that this is likely to be an issue for the Ubuntu packages, since users can install the Kern casacore data package. But it should be available as an option.

In future it may be a good idea for us to revise how we separate the release and beta files, and where we put files which can safely be shared by both.