GithubHelp home page GithubHelp logo

Comments (4)

AntSimi avatar AntSimi commented on July 1, 2024

Use to_netcdf method https://py-eddy-tracker.readthedocs.io/en/latest/_modules/py_eddy_tracker/observations/observation.html#EddiesObservations.to_netcdf

from py-eddy-tracker.

thomaseocean avatar thomaseocean commented on July 1, 2024

I use the data of aviso to detect the vortex and store it as NC data. It takes ten days. One day, the data is stored in an NC file. But when I track the vortex, the result is wrong. I don't know if there is something wrong with the function I called? Please provide some help,Another problem is how to store the test results of ten days in zarr. I will only store the test results of one day in zarr according to your instance code. I see that the sample data you provided is to store many test results in zarr, and the tracking code also reads the zarr data

import logging
from py_eddy_tracker.gui import GUI
from matplotlib import pyplot as plt
from netCDF4 import Dataset
import os
from py_eddy_tracker import start_logger
from py_eddy_tracker.data import get_remote_demo_sample
from py_eddy_tracker.featured_tracking.area_tracker import AreaTracker
import py_eddy_tracker.observations.observation
from py_eddy_tracker.tracking import Correspondances

py_eddy_tracker.observations.observation._display_check_warning = False

# file_objects = get_remote_demo_sample(
#     "eddies_med_adt_allsat_dt2018/Anticyclonic_2010_2011_2012"
# )[:20]
def get_local_demo_sample(folder_path):

    if not os.path.exists(folder_path):
        raise FileNotFoundError(f"The folder {folder_path} does not exist.")
    
    nc_files = []
    for filename in os.listdir(folder_path):
        if filename.endswith(".nc"):
            file_path = os.path.join(folder_path, filename)
            # nc_file = nc.Dataset(file_path, 'r')
            nc_files.append(file_path)
    
    return nc_files

def plot_eddy(ed):
    fig = plt.figure(figsize=(10, 5))
    ax = fig.add_axes([0.05, 0.03, 0.90, 0.94])
    ed.plot(ax, ref=-10, marker="x")
    lc = ed.display_color(ax, field=ed.time, ref=-10, intern=True)
    plt.colorbar(lc).set_label("Time in Julian days (from 1950/01/01)")
    ax.set_xlim(-180, 170), ax.set_ylim(-40, 40)
    ax.set_aspect("equal")
    ax.grid()
datapath = 'aviso_reult/Anticyclonic'
file_objects =get_local_demo_sample(datapath)

c = Correspondances(datasets=file_objects, class_method=AreaTracker, virtual=3)
c_first_run = Correspondances(
    datasets=file_objects, class_method=AreaTracker, virtual=10
)

start_logger().setLevel("INFO")
c_first_run.track()
start_logger().setLevel("WARNING")
with Dataset("correspondances.nc", "w") as h:
    c_first_run.to_netcdf(h)
# Next step are done only to build atlas and display it
c_first_run.prepare_merging()

# We have now an eddy object
eddies_area_tracker = c_first_run.merge(raw_data=False)
eddies_area_tracker.virtual[:] = eddies_area_tracker.time == 0
eddies_area_tracker.filled_by_interpolation(eddies_area_tracker.virtual == 1)
plot_eddy(eddies_area_tracker)

plt.show()

from py-eddy-tracker.

thomaseocean avatar thomaseocean commented on July 1, 2024

24dffb09da1b02addb8fb27f0586e0e

from py-eddy-tracker.

AntSimi avatar AntSimi commented on July 1, 2024

Zarr or netcdf is only a storage format and could be use to store identification or tracking. You need to apply a tracking on your identification file to create an atlas. You could also merge all identification result in one collection.

from py-eddy-tracker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.