コード例 #1
0
ファイル: GMTWriter.py プロジェクト: fretif/toolbox
 def __init__(self, myFile):   
     File.__init__(self,myFile); 
     self.ncfile = None
コード例 #2
0
 def __init__(self, xsize, ysize, myFile):
     File.__init__(self, myFile)
     self.ncfile = Dataset(self.filename, "r")
     self.x_size = xsize
     self.y_size = ysize
コード例 #3
0
ファイル: GMTWriter.py プロジェクト: fretif/toolbox
 def __init__(self, myFile):
     File.__init__(self,myFile);         
コード例 #4
0
ファイル: SymphonieReader.py プロジェクト: fretif/toolbox
 def __init__(self,myGrid, myFile):   
     File.__init__(self,myFile); 
     self.ncfile = Dataset(self.filename, 'r')
     self.grid = Dataset(myGrid, 'r')
コード例 #5
0
    def __init__(self, cov,resX,resY,myFile, depths):
        """
    Constructeur
    @param cov : la coverage
    @param resX : résolution souhaitée en X, en degrès
    @param resY : résolution souhaitée en Y, en degrès
    @param myFile : fichier de destination
    @param depths : tableau des profondeurs souhaitée (entier = couche, flottant = profondeur)
    """
        File.__init__(self,myFile);
        self.coverage = cov;

        self.targetResX = resX
        self.targetResY = resY;
        self.targetDepths = depths

        # we compute the destination grid
        Ymin=np.min(self.coverage.read_axis_y())
        Ymax=np.max(self.coverage.read_axis_y())
        Xmin=np.min(self.coverage.read_axis_x())
        Xmax=np.max(self.coverage.read_axis_x())

        res=np.mean([self.targetResX,self.targetResY])
        self.lon_reg,self.lat_reg=np.meshgrid(np.arange(Xmin, Xmax, res),np.arange(Ymin, Ymax, res))
        targetAxisX = self.lon_reg[0,:]
        targetAxisY= self.lat_reg[:,0]

        self.ncfile = Dataset(self.filename, 'w', format='NETCDF4')
        self.ncfile.description = 'Coverage Interpolator. Generated with Coverage Processing tools'

        # dimensions
        self.ncfile.createDimension('latitude', np.shape(targetAxisY)[0])
        self.ncfile.createDimension('longitude', np.shape(targetAxisX)[0])

        # variables
        latitudes = self.ncfile.createVariable('latitude', float32, ('latitude',))
        latitudes.units = "degree_north" ;
        latitudes.long_name = "latitude" ;
        latitudes.standard_name = "latitude" ;
        latitudes.valid_min = "-90.f";
        latitudes.valid_max = "90.f" ;
        latitudes.axis = "Y" ;

        longitudes = self.ncfile.createVariable('longitude', float32, ('longitude',))
        longitudes.units = "degree_east" ;
        longitudes.long_name = "longitude" ;
        longitudes.standard_name = "longitude" ;
        longitudes.valid_min = "-180.f" ;
        longitudes.valid_max = "180.f" ;
        longitudes.axis = "X" ;

        # data
        latitudes[:] = targetAxisY;
        longitudes[:] = targetAxisX;

        if(isinstance(self.coverage, TimeCoverage) or isinstance(self.coverage, TimeLevelCoverage)):

            self.ncfile.createDimension('time', None)
            times = self.ncfile.createVariable('time', float64, ('time',))
            times.units= 'seconds since 1970-01-01 00:00:00'
            times.calendar= 'gregorian'
            times.standard_name= 'time'
            times.axis='T'
            times.conventions = "UTC time"

            times[:] = date2num(self.coverage.read_axis_t(), units = times.units, calendar = times.calendar)

        if(isinstance(self.coverage, LevelCoverage) or isinstance(self.coverage, TimeLevelCoverage)):

            self.ncfile.createDimension('depth', np.size(self.targetDepths))
            levels = self.ncfile.createVariable('depth', float64, ('depth',))
            levels.standard_name= 'depth'
            levels.long_name="Positive depth"
            levels.units = "m" ;
            levels.axis='Z'

            levels[:] = self.targetDepths
コード例 #6
0
ファイル: SiroccoWriter.py プロジェクト: fretif/toolbox
    def __init__(self,cov,myFile,depths):
        File.__init__(self,myFile);
        self.coverage = cov;
        self.targetDepths = depths
        self.ncfile = Dataset(self.filename, 'w', format='NETCDF4')
        self.ncfile.description = 'Sirocco Writer. Generated with Coverage Processing tools'

        # dimensions
        self.ncfile.createDimension('latitude', self.coverage.get_y_size())
        self.ncfile.createDimension('longitude', self.coverage.get_x_size())

        if self.coverage.is_regular_grid()==True:

            # variables
            latitudes = self.ncfile.createVariable('latitude', float32, ('latitude',))
            latitudes.units = "degree_north" ;
            latitudes.long_name = "latitude" ;
            latitudes.standard_name = "latitude" ;
            latitudes.valid_min = "-90.f";
            latitudes.valid_max = "90.f" ;
            latitudes.axis = "Y" ;

            longitudes = self.ncfile.createVariable('longitude', float32, ('longitude',))
            longitudes.units = "degree_east" ;
            longitudes.long_name = "longitude" ;
            longitudes.standard_name = "longitude" ;
            longitudes.valid_min = "-180.f" ;
            longitudes.valid_max = "180.f" ;
            longitudes.axis = "X" ;

            # data
            latitudes[:] = self.coverage.read_axis_y();
            longitudes[:] = self.coverage.read_axis_x();

        else:

            latitudes = self.ncfile.createVariable('latitude', float32, ('latitude','longitude',))
            latitudes.units = "degree_north" ;
            latitudes.long_name = "latitude" ;
            latitudes.standard_name = "latitude" ;
            latitudes.valid_min = "-90.f";
            latitudes.valid_max = "90.f" ;
            latitudes.axis = "Y" ;

            longitudes = self.ncfile.createVariable('longitude', float32, ('latitude','longitude',))
            longitudes.units = "degree_east" ;
            longitudes.long_name = "longitude" ;
            longitudes.standard_name = "longitude" ;
            longitudes.valid_min = "-180.f" ;
            longitudes.valid_max = "180.f" ;
            longitudes.axis = "X" ;

            # data
            latitudes[:,:] = self.coverage.read_axis_y();
            longitudes[:,:] = self.coverage.read_axis_x();


        if(isinstance(self.coverage, TimeCoverage) or isinstance(self.coverage, TimeLevelCoverage)):

            self.ncfile.createDimension('time', None)
            times = self.ncfile.createVariable('time', float64, ('time',))
            times.units= 'seconds since 1970-01-01 00:00:00'
            times.calendar= 'gregorian'
            times.standard_name= 'time'
            times.axis='T'
            times.conventions = "UTC time"

            times[:] = date2num(self.coverage.read_axis_t(), units = times.units, calendar = times.calendar)

        if(isinstance(self.coverage, LevelCoverage) or isinstance(self.coverage, TimeLevelCoverage)):

            self.ncfile.createDimension('depth', np.size(self.targetDepths))
            levels = self.ncfile.createVariable('depth', float64, ('depth',))
            levels.standard_name= 'depth'
            levels.long_name="Positive depth"
            levels.axis='Z'

            levels[:] = self.targetDepths
コード例 #7
0
ファイル: ECMWFReader2.py プロジェクト: fretif/toolbox
 def __init__(self, myFile):
     File.__init__(self,myFile);         
     self.ncfile = Dataset(self.filename, 'r')
コード例 #8
0
ファイル: Litto3DReader.py プロジェクト: fretif/toolbox
 def __init__(self, myFile):
     File.__init__(self,myFile);
     self.metadata= {}