auscophub.dirstruct

Utility functions for handling the storage directory structure on the AusCopernicus Hub server.

exception auscophub.dirstruct.AusCopDirStructError
class auscophub.dirstruct.ZipfileSysInfo(zipfilename)

Information about the zipfile which can be obtained at operating system level, without understanding the internal structure of the zipfile (i.e. it is just a file).

static md5hash(zipfilename)

Calculate the md5 hash of the given zipfile

auscophub.dirstruct.checkFinalDir(finalOutputDir, dummy, verbose)

Check that the final output dir exists, and has write permission. If it does not exist, then create it

auscophub.dirstruct.createPreviewImg(zipfilename, finalOutputDir, metainfo, dummy, verbose, noOverwrite, makereadonly=False)

Create the preview image, in the final output directory

auscophub.dirstruct.createSentinel1Xml(zipfilename, finalOutputDir, metainfo, dummy, verbose, noOverwrite, md5esa, makereadonly=False)

Create the XML file in the final output directory, for Sentinel-1 zipfiles. This is a locally-designed XML file intended to include only the sort of information users would need in order to select zipfiles for download.

auscophub.dirstruct.createSentinel2Xml(zipfilename, finalOutputDir, metainfo, dummy, verbose, noOverwrite, md5esa, makereadonly=False)

Create the XML file in the final output directory, for Sentinel-2 zipfiles. This is a locally-designed XML file intended to include only the sort of information users would need in order to select zipfiles for download.

auscophub.dirstruct.createSentinel3Xml(zipfilename, finalOutputDir, metainfo, dummy, verbose, noOverwrite, md5esa, makereadonly=False)

Create the XML file in the final output directory, for Sentinel-3 zipfiles. This is a locally-designed XML file intended to include only the sort of information users would need in order to select zipfiles for download.

auscophub.dirstruct.createSentinel5Xml(ncfilename, finalOutputDir, metainfo, dummy, verbose, noOverwrite, md5esa, makereadonly=False)

Create the XML file in the final output directory, for Sentinel-5 netCDF files. This is a locally-designed XML file intended to include only the sort of information users would need in order to select ncfiles for download.

Note that I have left the top-level XML tag as <AUSCOPHUB_SAFE_FILEDESCRIPTION>, even though technically this is not a SAFE format file, because there is a lot of other stuff which assumes this down the track, and it was not worth changing it. I should have used a more generic tag name in the first place (with hindsight).

auscophub.dirstruct.latHemisphereChar(latitude)

Appropriate hemisphere character for given latitude (i.e. “N” or “S”)

auscophub.dirstruct.longHemisphereChar(longitude)

Appropriate hemisphere character for given longitude (i.e. “E” or “W”)

auscophub.dirstruct.makeDateDir(metainfo)

Return the string for the date subdirectory. The date is the acquistion date of the imagery. Returns a directory name for yyyy-mm-dd.

auscophub.dirstruct.makeGridSquareDir(metainfo, gridCellSize)

Make the grid square directory name, from the centroid location. Divides up into lat/long grid cells of the given size (given in degrees). Returns a string of the resulting subdirectory name

auscophub.dirstruct.makeInstrumentDir(metainfo)

Return the directory we will use at the ‘instrument’ level, based on the metainfo object.

auscophub.dirstruct.makeProductDir(metainfo)

Return the directory we will use at the ‘product’ level, based on the metainfo object.

auscophub.dirstruct.makeRelativeOutputDir(metainfo, gridCellSize, productDirGiven=False)

Make the output directory string for the given zipfile metadata object. The gridCellSize parameter is in degrees.

The productDirGiven argument is provided in order to be able to reproduce the old behaviour, in which the upper directory levels satellite/instrument/product are not generated here, but were assumed to have been given in some other way. If productDirGiven is True, the result will not include these levels.

auscophub.dirstruct.makeSatelliteDir(metainfo)

Make the directory name for the ‘satellite’ level.

auscophub.dirstruct.makeYearMonthDir(metainfo)

Return the string for the year/month subdirectory. The date is the acquistion date of the imagery. Returns a directory structure for year/year-month, as we want to divide the months up a bit. After we have a few years of data, it could become rather onerous if we do not divide them.

auscophub.dirstruct.moveZipfile(zipfilename, finalOutputDir, dummy, verbose, makeCopy, makeSymlink, nooverwrite, moveandsymlink, makereadonly=False)

Move the given zipfile to the final output directory

auscophub.dirstruct.processingLevel(metainfo)

Return processing Level based on satellite and productType.