UCL / pyCascadia

Implementation of GEBCO cookbook remove-restore and other cleaning of topography/bathymetry. Uses `pyGMT`.
Mozilla Public License 2.0
9 stars 0 forks source link

Add tool for removing variables from netcdf files #64

Closed JamieJQuinn closed 3 years ago

JamieJQuinn commented 3 years ago

This PR adds a small tool which can strip a variable from a netcdf file. This is useful for datasets where there is more than one variable, which can be an issue for the loaders (see #59).

Devaraj-G commented 3 years ago

@JamieJQuinn Does this default to Band 1 if multiple bands are present in the input file? Or do I have to specify the band?

JamieJQuinn commented 3 years ago

@JamieJQuinn Does this default to Band 1 if multiple bands are present in the input file? Or do I have to specify the band?

@Devaraj-G This tool just delete variables, it doesn't touch any bands at all.

In remove-restore, if there are multiple bands I think it will fail, but AFAIK the bands are usually only important for satellite data (i.e. different bands for different wavelengths). If we come up against that kind of problem in a specific file we can deal with it.

Devaraj-G commented 3 years ago

@JamieJQuinn Does this default to Band 1 if multiple bands are present in the input file? Or do I have to specify the band?

@Devaraj-G This tool just delete variables, it doesn't touch any bands at all.

In remove-restore, if there are multiple bands I think it will fail, but AFAIK the bands are usually only important for satellite data (i.e. different bands for different wavelengths). If we come up against that kind of problem in a specific file we can deal with it.

So, the problematic dataset in #59 need be still pre-processed? Or, this PR solves it.

JamieJQuinn commented 3 years ago

So, the problematic dataset in #59 need be still pre-processed? Or, this PR solves it.

Yes, it will still have to be pre-processed. I can't think of an easy, general way to pick the correct variable from a dataset containing multiple variables. Are there many files like that?

Devaraj-G commented 3 years ago

So, the problematic dataset in #59 need be still pre-processed? Or, this PR solves it.

Yes, it will still have to be pre-processed. I can't think of an easy, general way to pick the correct variable from a dataset containing multiple variables. Are there many files like that?

Maybe less than 10 .nc files. There are some NOAA TIFFs too. Haven't checked if they create problems.

JamieJQuinn commented 3 years ago

Maybe less than 10 .nc files. There are some NOAA TIFFs too. Haven't checked if they create problems.

OK. LMK if more files like strait_of_juan... turn up and we can maybe figure out a better way than just pre-processing each one.