kvos / CoastSat

Global shoreline mapping tool from satellite imagery
http://coastsat.space
GNU General Public License v3.0
696 stars 252 forks source link

Access to FES2022 NetCDF Files on SharePoint #537

Closed ruby-vallarino closed 3 weeks ago

ruby-vallarino commented 1 month ago

Hello Dr. Vos,

First of all, thank you for the recent update in "CoastSat -2.4 Tidal Correction" and for providing access to the FES2022 NetCDF files. I noticed that the files are hosted on a SharePoint link from UNSW, but it seems that access is restricted to users with institutional accounts. Unfortunately, without a UNSW account, I'm unable to download the files.

Could you kindly advise if there is an alternative way to access these files for users outside the institution? Any help or guidance on this would be greatly appreciated.

Thanks again for your excellent work.

Best regards,

Ruby

kvos commented 1 month ago

hi @ruby-vallarino , didn't realise that link was restricted. So you will have to get the netcdf files yourself, with involves the following steps:

It's a long process so I was hoping providing the link would make it easier but I guess I will have to provide full download instructions. Try it out and let me know if it works, thanks.

kvos commented 1 month ago

see https://github.com/kvos/CoastSat/blob/master/doc/FES2022_setup.md

ruby-vallarino commented 1 month ago

Thank you very much for your prompt response and the detailed explanation, Dr. Vos.

As soon as I am able to download the information and apply the tidal correction, I will update my response. At the moment, I am waiting for the Aviso team to grant me access to the subscriptions.

ruby-vallarino commented 1 month ago

Dr. Vos @kvos , I have been following the instructions you provided to perform the tidal correction. However, I am encountering difficulties in obtaining the necessary data for this correction. When running the code, I am unable to retrieve the tide data, and I am unsure of the cause. Initially, I thought the issue might be related to the download of the FES2022b files (load_tide and ocean_tide), but I have already deleted and re-downloaded them without success. I am attaching an image where you can see the problem I am experiencing. Additionally, although I'm not sure if it’s related, I have made adjustments to my laptop’s virtual memory, but the problem persists. I would appreciate any assistance you can provide to help resolve this issue. Thank you.

Capture 1 Capture 2
phillipjws commented 1 month ago

I too am running into this issue, I looked deeper into the nc files and found that the set I downloaded had longitude bounds of (0.0, 0.0), I assumed this was an issue with my download, but may be worth checking. Might be an issue with the files from aviso, although the handbook has this as expected. It seems to work when using the NARRA examply in example.py from fes2022, but I can't get any other locations working. Heres the script I used to check the bounds for all the files, just need to adjust the paths to match your setup if you want to check.

from netCDF4 import Dataset
import os
import numpy as np

directories = {
    "ocean_tide": r"C:\Users\psteeves\coastal\ocean_tide",
    "load_tide": r"C:\Users\psteeves\coastal\load_tide"
}

for dir_name, directory in directories.items():
    print(f"\nChecking directory: {dir_name}")
    for filename in os.listdir(directory):
        if filename.endswith(".nc"):
            filepath = os.path.join(directory, filename)
            try:
                # Open the NetCDF file and read latitude and longitude bounds
                with Dataset(filepath, 'r') as nc:
                    lat_bounds = (np.min(nc['lat'][:]), np.max(nc['lat'][:]))
                    lon_bounds = (np.min(nc['lon'][:]), np.max(nc['lon'][:]))

                print(f"File: {filename} | Lat: {lat_bounds} | Lon: {lon_bounds}")

            except Exception as e:
                print(f"Failed to read {filename}: {e}")
kvos commented 1 month ago

have you tried using longitudes between 0 and 360? instead of -180 to 180

ruby-vallarino commented 1 month ago

@kvos Thank you very much for your help!!! I have successfully obtained the tide data for my study area.

AryanAdhau commented 1 month ago

Hii @kvos, I am encountering this issue. Could you please help. I am worried with this one.

pyfes

kvos commented 1 month ago

maybe you have an old pyfes installation. can you run pyfes.__version__ and print the output here?

AryanAdhau commented 1 month ago

My pyfes version is 2.9.5

phillipjws commented 1 month ago

I needed to use

conda install pyfes

as opposed to

conda install fbriol::pyfes

Seems the version got moved to the default conda-forge channel, although this change was not updated somewhere in the documentation, seemed to resolve my issue

AryanAdhau commented 1 month ago

Thanks @phillipjws!

I tried, but it didn't work for me :/

phillipjws commented 1 month ago

@AryanAdhau You may also want to use pip uninstall pyfes before you reinstall it with conda, I found sometimes pip points here which isn't the package you want to use. These were just my troubleshooting steps that seemed to resolve that issue, hopefully you get it figured out.

kvos commented 1 month ago

I needed to use

conda install pyfes

as opposed to

conda install fbriol::pyfes

Seems the version got moved to the default conda-forge channel, although this change was not updated somewhere in the documentation, seemed to resolve my issue

you're right it's been moved. I'll update the README