예제 #1
0
                        level=logging.INFO)

    # Read file
    reader = SymphonieReader2015(
        '/work/sciences/projects/WWB-2017/Manicouagan/configuration_V2015/TStra_N/OFFLINE/grid.nc',
        '/work/sciences/projects/WWB-2017/Manicouagan/configuration_V2015/TStra_N/GRAPHIQUES/20090301_071217.nc'
    )

    coverageOrig = TimeLevelCoverage(reader)

    # InterpolatorCore.INTERPOLATION_METHOD = "linear";
    InterpolatorCore.INTERPOLATION_METHOD = "nearest"

    depths = np.array([0.0, 10.0, 50.0, 100.0])
    coverage = TimeLevelCoverage(
        CoverageInterpolator(coverageOrig, 0.001, 0.001, depths))

    #Renommer toutes les noms des fonctions
    writer = DefaultWriter(coverage, '/tmp/symphonie_regular.nc')

    writer.write_variable_baroclinic_sea_water_velocity()
    writer.write_variable_barotropic_sea_water_velocity()
    writer.write_variable_sea_surface_height_above_mean_sea_level()
    writer.write_variable_wind_stress()
    writer.write_variable_sea_water_temperature()
    writer.write_variable_sea_water_salinity()
    # writer.write_variable_wet_binary_mask()
    writer.write_variable_2D_sea_binary_mask()
    writer.write_variable_wind_10m()
    writer.write_variable_mesh_size()
    #writer.write_variable_sea_surface_wave_significant_height()
    
    logging.basicConfig(format='[%(levelname)s] %(message)s',level=logging.INFO)
    
    # Read file
    reader = MercatorReader('/home/retf/work/fieldsites/med-cruesim/modelling/mercator/grid/mercator_grid.nc',
                            '/home/retf/work/fieldsites/med-cruesim/modelling/mercator/netcdf/pool/ext-PSY2V4R4_1dAV_20120706_20120707_grid2D_R20120711.nc',
                            '/home/retf/work/fieldsites/med-cruesim/modelling/mercator/netcdf/pool/ext-PSY2V4R4_1dAV_20120706_20120707_gridT_R20120711.nc',
                            '/home/retf/work/fieldsites/med-cruesim/modelling/mercator/netcdf/pool/ext-PSY2V4R4_1dAV_20120706_20120707_gridU_R20120711.nc',
                            '/home/retf/work/fieldsites/med-cruesim/modelling/mercator/netcdf/pool/ext-PSY2V4R4_1dAV_20120706_20120707_gridV_R20120711.nc')

        
    coverage = TimeLevelCoverage(reader);

    LevelCoverage.LEVEL_DELTA = 50.0 # On change le delta par défaut pour trouver une couche

    interpolator = CoverageInterpolator(coverage,0.01,0.01,'/home/retf/work/fieldsites/med-cruesim/modelling/mercator/netcdf/pool/test_resample.nc') # résolution voulue en degrès
    interpolator.resample_variable_current_at_level(155.0) # on peut donner la profondeur en mètres positifs (plus proche) ou en indice de couche verticale.
    interpolator.resample_variable_ssh()
    interpolator.close()
    
    print 'End of programm'
     
    
    
    
       
        
    
    
    
    
if __name__ == "__main__":
    print("Transform/Interpole Symphonie to GMT")
    
    logging.basicConfig(format='[%(levelname)s] %(message)s',level=logging.INFO)

    # Read file
    reader = WW3Reader('/work/sciences/projects/ArcEmeraude_2018/waves/Re_ Bon___/ww3.20150105_T405_2s.nc')

    coverageOrig = TimeCoverage(reader);

    # InterpolatorCore.INTERPOLATION_METHOD = "linear";
    InterpolatorCore.INTERPOLATION_METHOD = "nearest";

    depths = np.array([])
    coverage = TimeCoverage(CoverageInterpolator(coverageOrig, 0.1, 0.1, depths))

    #Renommer toutes les noms des fonctions
    writer = DefaultWriter(coverage, '/tmp/ww3_regular.nc')

    writer.write_variable_barotropic_sea_water_velocity()
    writer.write_variable_sea_surface_height_above_mean_sea_level()
    writer.write_variable_2D_sea_binary_mask()
    writer.write_variable_sea_surface_wave_significant_height()
    writer.write_variable_sea_surface_wave_mean_period()
    # writer.write_variable_sea_surface_wave_peak_period()
    writer.write_variable_sea_surface_wave_from_direction()
    writer.write_variable_sea_surface_wave_to_direction()
    writer.write_variable_atmosphere_momentum_flux_to_waves()
    writer.write_variable_waves_momentum_flux_to_ocean()
    writer.write_variable_sea_surface_wave_stokes_drift_velocity()
from coverage.operator.interpolator.CoverageInterpolator import CoverageInterpolator
from coverage.io.netcdf.symphonie.SymphonieReader import SymphonieReader
import logging

if __name__ == "__main__":
    print("Transform/Interpole Symphonie to GMT")
    
    logging.basicConfig(format='[%(levelname)s] %(message)s',level=logging.INFO)
    
    # Read file
    reader = SymphonieReader('GRAPHIQUES/grid.nc',
                             'GRAPHIQUES/20110320_000002.nc')

    coverage = TimeLevelCoverage(reader);

    interpolator = CoverageInterpolator(coverage,0.02,0.02,'GRAPHIQUES/20110220_regular.nc',
                                        []) # résolution voulue en degrès
    #interpolator = CoverageInterpolator(coverage,0.02,0.02,'GRAPHIQUES/20110220_regular.nc',
    #                                    [0.0,10.0,50.0,150.0,200.0,250.0,300.0,350.0,400.0,450.0,500.0,550.0,600.0,650.0,700.0,750.0,850.0,900.0,950.0,1000.0,1100.0,1200.0,1300.0,1400.0,1500.0,1600.0,1700.0,1800.0,1900.0,2000.0,2300.0,2400.0,2500.0,2600.0,2700.0,2850.0,2870.0]) # résolution voulue en degrès


    #interpolator.resample_variable_current_at_depths()
    interpolator.resample_variable_salinity_at_depths()
    #interpolator.resample_variable_ssh()
    #interpolator.resample_variable_current()
    #interpolator.resample_variable_2D_mask()
    #interpolator.resample_variable_waves_dir()
    #interpolator.resample_variable_hs()
    #interpolator.resample_variable_wind()
    #interpolator.resample_variable_mesh_size()
    #interpolator.resample_variable_wetmask()
    interpolator.close()
from coverage.TimeCoverage import TimeCoverage
from coverage.operator.interpolator.CoverageInterpolator import CoverageInterpolator
from coverage.io.netcdf.ww3.WW3Reader import WW3Reader
import logging

if __name__ == "__main__":
    """
    Cette routine permet d'interpoler des résultats de WaveWatchIII sur une grille régulière.
    """
    print ("Transform/Interpole WW3 to GMT ")

    logging.basicConfig(format="[%(levelname)s] %(message)s", level=logging.INFO)

    # Read file
    reader = WW3Reader("/home/retf/work/fieldsites/med-cruesim/modelling/waves/med/outputs/netcdf/ww3.201103.nc")

    coverage = TimeCoverage(reader)

    interpolator = CoverageInterpolator(
        coverage,
        0.01,
        0.01,
        "/home/retf/work/fieldsites/med-cruesim/modelling/waves/med/outputs/netcdf/regular/ww3.201103.nc",
    )  # résolution voulue en degrès
    interpolator.resample_variable_current()
    interpolator.resample_variable_ssh()
    interpolator.close()

    print "End of programm"